diff options
author | Leon Merten Lohse <leon@green-side.de> | 2012-03-27 17:46:43 +0200 |
---|---|---|
committer | Leon Merten Lohse <leon@green-side.de> | 2012-03-27 17:46:43 +0200 |
commit | 662c41ef60169d003c6de37455639e10cacb3f29 (patch) | |
tree | e45c6dbefce2c6c472c8c44ee3c3fd578c945527 /test | |
parent | 3940726aa77d102096117fb2f47aa2bb41c8abdc (diff) | |
parent | b052c43389f8e028211595d6f352200f7c30149a (diff) |
Merge branch 'master' of ssh://git.sv.gnu.org/srv/git/libcdio
Diffstat (limited to 'test')
-rwxr-xr-x | test/Makefile.am | 2 | ||||
-rw-r--r-- | test/check_opts0.right | 2 | ||||
-rw-r--r-- | test/check_opts1.right | 2 | ||||
-rw-r--r-- | test/check_opts2.right | 2 | ||||
-rw-r--r-- | test/check_opts3.right | 2 | ||||
-rw-r--r-- | test/check_opts4.right | 2 | ||||
-rw-r--r-- | test/check_opts5.right | 2 | ||||
-rw-r--r-- | test/check_opts6.right | 2 | ||||
-rw-r--r-- | test/check_opts7.right | 2 | ||||
-rw-r--r-- | test/data/isofs-m1.cue | 1 | ||||
-rw-r--r-- | test/driver/Makefile.am | 4 | ||||
-rw-r--r-- | test/driver/gnu_linux.c | 12 | ||||
-rw-r--r-- | test/driver/helper.c | 74 | ||||
-rw-r--r-- | test/driver/helper.h | 17 |
14 files changed, 109 insertions, 17 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 5c6d267a..6a7eef1d 100755 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -31,7 +31,7 @@ hack = check_sizeof testassert testgetdevices testischar \ EXTRA_PROGRAMS = testdefault DATA_DIR = @abs_top_srcdir@/test/data -INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS) $(LIBISO9660_CFLAGS) +INCLUDES = $(LIBCDIO_CFLAGS) $(LIBISO9660_CFLAGS) check_sizeof_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV) testassert_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) diff --git a/test/check_opts0.right b/test/check_opts0.right index f5e163fc..5b6d6873 100644 --- a/test/check_opts0.right +++ b/test/check_opts0.right @@ -1,7 +1,7 @@ __________________________________ Disc mode is listed as: CD-DATA (Mode 1) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/check_opts1.right b/test/check_opts1.right index f5e163fc..5b6d6873 100644 --- a/test/check_opts1.right +++ b/test/check_opts1.right @@ -1,7 +1,7 @@ __________________________________ Disc mode is listed as: CD-DATA (Mode 1) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/check_opts2.right b/test/check_opts2.right index c4712945..6477819f 100644 --- a/test/check_opts2.right +++ b/test/check_opts2.right @@ -5,5 +5,5 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver diff --git a/test/check_opts3.right b/test/check_opts3.right index c4712945..6477819f 100644 --- a/test/check_opts3.right +++ b/test/check_opts3.right @@ -5,5 +5,5 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver diff --git a/test/check_opts4.right b/test/check_opts4.right index e4977f34..aed4e947 100644 --- a/test/check_opts4.right +++ b/test/check_opts4.right @@ -5,7 +5,7 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/check_opts5.right b/test/check_opts5.right index e4977f34..aed4e947 100644 --- a/test/check_opts5.right +++ b/test/check_opts5.right @@ -5,7 +5,7 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/check_opts6.right b/test/check_opts6.right index e4977f34..aed4e947 100644 --- a/test/check_opts6.right +++ b/test/check_opts6.right @@ -5,7 +5,7 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/check_opts7.right b/test/check_opts7.right index e4977f34..aed4e947 100644 --- a/test/check_opts7.right +++ b/test/check_opts7.right @@ -5,7 +5,7 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/data/isofs-m1.cue b/test/data/isofs-m1.cue index 677a803f..bead774e 100644 --- a/test/data/isofs-m1.cue +++ b/test/data/isofs-m1.cue @@ -1,3 +1,4 @@ +CATALOG 0000012101954
FILE "ISOFS-M1.BIN" BINARY
TRACK 01 MODE1/2352
INDEX 01 00:00:00
diff --git a/test/driver/Makefile.am b/test/driver/Makefile.am index f8f4f9e4..6f8b12c0 100644 --- a/test/driver/Makefile.am +++ b/test/driver/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010 Rocky Bernstein <rocky@gnu.org> +# Copyright (C) 2009, 2010, 2012 Rocky Bernstein <rocky@gnu.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS) $(LIBISO9660_CFLAGS) +INCLUDES = $(LIBCDIO_CFLAGS) $(LIBISO9660_CFLAGS) DATA_DIR = $(abs_top_srcdir)/test/data abs_path_SOURCES = abs_path.c diff --git a/test/driver/gnu_linux.c b/test/driver/gnu_linux.c index fdf998e5..f4571b3e 100644 --- a/test/driver/gnu_linux.c +++ b/test/driver/gnu_linux.c @@ -36,8 +36,6 @@ #include <string.h> #endif -#include <cdio/cdio.h> -#include <cdio/logging.h> #include "helper.h" int @@ -46,6 +44,7 @@ main(int argc, const char *argv[]) CdIo_t *p_cdio; char **ppsz_drives=NULL; + cdio_log_set_handler(log_handler); cdio_loglevel_default = (argc > 1) ? CDIO_LOG_DEBUG : CDIO_LOG_INFO; /* snprintf(psz_nrgfile, sizeof(psz_nrgfile)-1, "%s/%s", TEST_DIR, cue_file[i]); @@ -60,7 +59,14 @@ main(int argc, const char *argv[]) p_cdio = cdio_open_linux(ppsz_drives[0]); if (p_cdio) { const char *psz_source = NULL, *psz_scsi_tuple; - + lsn_t lsn; + + reset_counts(); + lsn = cdio_get_track_lsn(p_cdio, CDIO_CD_MAX_TRACKS+1); + assert_equal_int(CDIO_INVALID_LSN, lsn, + "cdio_get_track_lsn with too large of a track number"); + reset_counts(); + check_get_arg_source(p_cdio, ppsz_drives[0]); check_mmc_supported(p_cdio, 3); diff --git a/test/driver/helper.c b/test/driver/helper.c index b000de40..37aecfb4 100644 --- a/test/driver/helper.c +++ b/test/driver/helper.c @@ -16,7 +16,6 @@ */ #ifdef HAVE_CONFIG_H #include "config.h" -#define __CDIO_CONFIG_H__ 1 #endif #ifdef HAVE_STDIO_H @@ -29,9 +28,51 @@ #include <stdlib.h> #endif -#include <cdio/cdio.h> #include "helper.h" +unsigned int info_msg_count=0; +unsigned int debug_msg_count=0; +unsigned int warn_msg_count=0; +unsigned int error_msg_count=0; +const char *info_messages[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; +const char *debug_messages[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; +const char *warn_messages[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; +const char *error_messages[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; + +void +assert_equal_int(int expect, int got, const char *msg) +{ + if (expect != got) { + fprintf(stderr, "ERROR: Expected %d, got %d\n", expect, got); + if (NULL != msg) fprintf(stderr, "%s\n", msg); + exit(1); + } +} + +void +assert_no_warn(const char *msg) +{ + if (warn_msg_count != 0) { + unsigned int i; + fprintf(stderr, "ERROR: got unexpected warnings:\n"); + for (i=0; i<warn_msg_count; i++) { + fprintf(stderr, "%s\n", warn_messages[i]); + } + exit(1); + } +} + +void +assert_warn(const char *msg) +{ + if (warn_msg_count == 0) { + fprintf(stderr, + "ERROR: should have gotten a warning message:\n%s\n", + msg); + exit(1); + } +} + void check_access_mode(CdIo_t *p_cdio, const char *psz_expected_access_mode) { const char *psz_access_mode = cdio_get_arg(p_cdio, "access-mode"); @@ -78,3 +119,32 @@ void check_mmc_supported(CdIo_t *p_cdio, int i_expected) { exit(32); } } + +void +log_handler(cdio_log_level_t level, const char message[]) +{ + switch(level) { + case CDIO_LOG_DEBUG: + debug_messages[debug_msg_count] = message; + debug_msg_count++; + return; + case CDIO_LOG_INFO: + info_messages[info_msg_count] = message; + info_msg_count++; + return; + case CDIO_LOG_ERROR: + error_messages[info_msg_count] = message; + error_msg_count++; + return; + default: + warn_messages[warn_msg_count] = message; + warn_msg_count++; + return; + } +} + +void +reset_counts(void) +{ + info_msg_count = debug_msg_count = warn_msg_count = 0; +} diff --git a/test/driver/helper.h b/test/driver/helper.h index 7483eefe..cffd303e 100644 --- a/test/driver/helper.h +++ b/test/driver/helper.h @@ -1,5 +1,5 @@ /* -*- C -*- - Copyright (C) 2010 Rocky Bernstein <rocky@gnu.org> + Copyright (C) 2010, 2012 Rocky Bernstein <rocky@gnu.org> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,8 +14,23 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <cdio/cdio.h> + void check_access_mode(CdIo_t *p_cdio, const char *psz_expected_access_mode); void check_get_arg_source(CdIo_t *p_cdio, const char *psz_expected_source); void check_mmc_supported(CdIo_t *p_cdio, int i_expected); +#include <cdio/logging.h> +void log_handler(cdio_log_level_t level, const char message[]); +extern unsigned int info_msg_count; +extern unsigned int debug_msg_count; +extern unsigned int warn_msg_count; +extern const char *info_messages[6]; +extern const char *debug_messages[6]; +extern const char *warn_messages[6]; +extern void assert_equal_int(int expect, int got, const char *msg); +extern void reset_counts(void); +extern void assert_warn(const char *msg); +extern void assert_no_warn(const char *msg); |