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 #endif -#include -#include #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 #endif -#include #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 + Copyright (C) 2010, 2012 Rocky Bernstein 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 . */ + +#include + 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 +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);