Add run-time variables for libcdio version number/string.
This commit is contained in:
@@ -5,8 +5,15 @@
|
||||
* number (@LIBCDIO_VERSION_NUM@) and OS build name.
|
||||
*/
|
||||
|
||||
/*! CDIO_VERSION can as a string in programs to show what version is used. */
|
||||
/*! CDIO_VERSION can as a string in programs to show what version is
|
||||
used. cdio_version_string is the same thing but represented as a
|
||||
constant in memory. */
|
||||
#define CDIO_VERSION "@VERSION@ @build@"
|
||||
extern const char *cdio_version_string; /**< = CDIO_VERSION */
|
||||
|
||||
/*! LIBCDIO_VERSION_NUM can be used for testing in the C preprocessor */
|
||||
/*! LIBCDIO_VERSION_NUM can be used for testing in the C preprocessor,
|
||||
libcdio_version_num is the same thing but reresented as a constant
|
||||
in memory. */
|
||||
#define LIBCDIO_VERSION_NUM @LIBCDIO_VERSION_NUM@
|
||||
|
||||
extern const unsigned int libcdio_version_num; /**< = LIBCDIO_VERSION_NUM */
|
||||
|
||||
@@ -23,6 +23,11 @@ cdio_audio_read_subchannel
|
||||
cdio_audio_resume
|
||||
cdio_audio_set_volume
|
||||
cdio_audio_stop
|
||||
cdio_charset_convert
|
||||
cdio_charset_converter_create
|
||||
cdio_charset_converter_destroy
|
||||
cdio_charset_from_utf8
|
||||
cdio_charset_to_utf8
|
||||
cdio_close_tray
|
||||
cdio_debug
|
||||
cdio_destroy
|
||||
@@ -80,14 +85,14 @@ cdio_get_track_channels
|
||||
cdio_get_track_copy_permit
|
||||
cdio_get_track_format
|
||||
cdio_get_track_green
|
||||
cdio_get_track_isrc
|
||||
cdio_get_track_last_lsn
|
||||
cdio_get_track_lba
|
||||
cdio_get_track_pregap_lba
|
||||
cdio_get_track_pregap_lsn
|
||||
cdio_get_track_isrc
|
||||
cdio_get_track_lsn
|
||||
cdio_get_track_msf
|
||||
cdio_get_track_preemphasis
|
||||
cdio_get_track_pregap_lba
|
||||
cdio_get_track_pregap_lsn
|
||||
cdio_get_track_sec_count
|
||||
cdio_guess_cd_type
|
||||
cdio_have_atapi
|
||||
@@ -169,6 +174,7 @@ cdio_stream_getpos
|
||||
cdio_stream_read
|
||||
cdio_stream_seek
|
||||
cdio_to_bcd8
|
||||
cdio_version_string
|
||||
cdio_warn
|
||||
cdtext_destroy
|
||||
cdtext_field2str
|
||||
@@ -184,6 +190,7 @@ debug_cdio_mmc_get_conf
|
||||
debug_cdio_mmc_gpcmd
|
||||
debug_cdio_mmc_read_sub_state
|
||||
discmode2str
|
||||
libcdio_version_num
|
||||
mmc_audio_read_subchannel
|
||||
mmc_audio_state2str
|
||||
mmc_close_tray
|
||||
@@ -216,8 +223,3 @@ mmc_set_speed
|
||||
mmc_start_stop_media
|
||||
mmc_timeout_ms
|
||||
track_format2str
|
||||
cdio_charset_converter_create
|
||||
cdio_charset_converter_destroy
|
||||
cdio_charset_convert
|
||||
cdio_charset_from_utf8
|
||||
cdio_charset_to_utf8
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "cdio_assert.h"
|
||||
#include <cdio/types.h>
|
||||
#include <cdio/util.h>
|
||||
#include <cdio/version.h>
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 4096
|
||||
@@ -183,6 +184,8 @@ void cdio_follow_symlink (const char * src, char * dst) {
|
||||
#endif
|
||||
|
||||
}
|
||||
const char *cdio_version_string = CDIO_VERSION;
|
||||
const unsigned int libcdio_version_num = LIBCDIO_VERSION_NUM;
|
||||
|
||||
|
||||
/*
|
||||
|
||||
1
test/.gitignore
vendored
1
test/.gitignore
vendored
@@ -17,6 +17,7 @@
|
||||
/check_nrg.sh
|
||||
/check_paranoia.sh
|
||||
/check_sizeof
|
||||
/test_lib_driver_util
|
||||
/testassert
|
||||
/testbincue
|
||||
/testbincue.c
|
||||
|
||||
@@ -27,7 +27,7 @@ testparanoia_LDADD = $(LIBCDIO_PARANOIA_LIBS) $(LIBCDIO_CDDA_LIBS) $(LIBCDIO_LIB
|
||||
endif
|
||||
|
||||
hack = check_sizeof testassert testbincue testgetdevices testischar \
|
||||
testisocd testisocd2 testiso9660 testlinux \
|
||||
testisocd testisocd2 testiso9660 testlinux test_lib_driver_util \
|
||||
testnrg $(testparanoia) testtoc testpregap testsolaris
|
||||
|
||||
EXTRA_PROGRAMS = testdefault
|
||||
@@ -47,6 +47,9 @@ testisocd2_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV)
|
||||
testtoc_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
|
||||
testtoc_CFLAGS = -DTEST_DIR=\"$(srcdir)\"
|
||||
|
||||
test_lib_driver_util_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
|
||||
tets_lib_driver_util_CFLAGS = -DTEST_DIR=\"$(srcdir)\"
|
||||
|
||||
testlinux_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
|
||||
testlinux_CFLAGS = -DTEST_DIR=\"$(srcdir)\"
|
||||
|
||||
|
||||
48
test/test_lib_driver_util.c
Normal file
48
test/test_lib_driver_util.c
Normal file
@@ -0,0 +1,48 @@
|
||||
/* -*- C -*-
|
||||
Copyright (C) 2009 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
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/* Unit test for lib/driver/util.c */
|
||||
|
||||
#include <cdio/version.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main(int argc, const char *argv[])
|
||||
{
|
||||
if (0 != strncmp(cdio_version_string, CDIO_VERSION,
|
||||
strlen(CDIO_VERSION))) {
|
||||
fprintf(stderr, "CDIO VERSION string mismatch %s vs %s\n",
|
||||
cdio_version_string, CDIO_VERSION);
|
||||
exit(1);
|
||||
}
|
||||
if (libcdio_version_num != LIBCDIO_VERSION_NUM) {
|
||||
fprintf(stderr, "LIBCDIO_VERSION_NUM value mismatch %d vs %d\n",
|
||||
libcdio_version_num, LIBCDIO_VERSION_NUM);
|
||||
exit(2);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user