Applied in commit 099c431. Thanks.
On Tue, Oct 29, 2013 at 3:54 PM, Pete Batard <[email protected]> wrote: > As promised. > > This should produce the following when running make test: > > -- Volume id: NEU > PASS: testudf > > Regards, > > /Pete > > From d3705b04c06592e2a22834d146e5c653fae21264 Mon Sep 17 00:00:00 2001 > From: Pete Batard <[email protected]> > Date: Tue, 29 Oct 2013 19:45:47 +0000 > Subject: [PATCH] Add UDF test for Logical Volume ID > > --- > configure.ac | 1 + > test/.gitignore | 2 + > test/Makefile.am | 6 +++- > test/testudf.c.in | 79 > +++++++++++++++++++++++++++++++++++++++++++++++++++++ > 4 files changed, 86 insertions(+), 2 deletions(-) > create mode 100755 test/testudf.c.in > > diff --git a/configure.ac b/configure.ac > index a7ff495..2a87677 100755 > --- a/configure.ac > +++ b/configure.ac > @@ -721,6 +721,7 @@ AC_CONFIG_FILES([ > test/testisorr.c \ > test/testisocd2.c \ > test/testpregap.c \ > + test/testudf.c \ > test/Makefile \ > ]) > > diff --git a/test/.gitignore b/test/.gitignore > index 9a703ea..4468b05 100755 > --- a/test/.gitignore > +++ b/test/.gitignore > @@ -45,3 +45,5 @@ > /testpregap.c > /testsolaris > /testtoc > +/testudf > +/testudf.c > diff --git a/test/Makefile.am b/test/Makefile.am > index 2bd278c..be7e1f5 100755 > --- a/test/Makefile.am > +++ b/test/Makefile.am > @@ -22,7 +22,7 @@ SUBDIRS = data driver > > hack = check_sizeof testassert testgetdevices testischar \ > testisocd testisocd2 testisocd_joliet testiso9660 \ > - testisorr test_lib_driver_util \ > + testisorr test_lib_driver_util testudf \ > testpregap > > DATA_DIR = @abs_top_srcdir@/test/data > @@ -41,6 +41,8 @@ testisocd2_LDADD = $(LIBISO9660_LIBS) > $(LIBCDIO_LIBS) $(LTLIBICONV) > testisocd_joliet_LDADD= $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV) > testisorr_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV) > > +testudf_LDADD = $(LIBUDF_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV) > + > test_lib_driver_util_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) > test_lib_driver_util_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\" > > @@ -70,7 +72,7 @@ check_DATA = vcd_demo.right vcd_demo_vcdinfo.right \ > EXTRA_DIST = $(check_SCRIPTS) $(check_DATA) \ > check_common_fn check_cue.sh.in check_nrg.sh.in \ > testpregap.c.in testisorr.c.in check_legal.regex \ > - testgetdevices.c.in check_iso.sh.in \ > + testgetdevices.c.in check_iso.sh.in testudf.c.in \ > check_iso_read.sh.in > > TESTS = $(check_PROGRAMS) $(check_SCRIPTS) > diff --git a/test/testudf.c.in b/test/testudf.c.in > new file mode 100755 > index 0000000..2042629 > --- /dev/null > +++ b/test/testudf.c.in > @@ -0,0 +1,79 @@ > +/* > + Copyright (C) 2013 Rocky Bernstein <[email protected]> > + Copyright (C) 2013 Pete Batard <[email protected]> > + > + 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/>. > +*/ > + > +/* Tests reading UDF info from an UDF image. */ > + > +#define UDF_IMAGE "@native_abs_top_srcdir@/test/udf102.iso" > + > +#ifdef HAVE_CONFIG_H > +#include "config.h" > +#define __CDIO_CONFIG_H__ 1 > +#endif > + > +#ifdef HAVE_STDIO_H > +#include <stdio.h> > +#endif > +#ifdef HAVE_STDLIB_H > +#include <stdlib.h> > +#endif > +#ifdef HAVE_STRING_H > +#include <string.h> > +#endif > +#ifdef HAVE_UNISTD_H > +#include <unistd.h> > +#endif > +#ifdef HAVE_SYS_TYPES_H > +#include <sys/types.h> > +#endif > + > +#include <cdio/cdio.h> > +#include <cdio/udf.h> > + > +int > +main(int argc, const char *argv[]) > +{ > + char const *psz_fname = UDF_IMAGE; > + char volume_id[192]; /* 3*64 to account for UTF-8 */ > + udf_t* p_udf = NULL; > + udf_dirent_t* p_udf_root; > + > + p_udf = udf_open(psz_fname); > + > + if (NULL == p_udf) { > + fprintf(stderr, "Sorry, couldn't open %s as an UDF image\n", > + psz_fname); > + return 1; > + } > + > + p_udf_root = udf_get_root(p_udf, true, 0); > + if (NULL == p_udf_root) { > + fprintf(stderr, "Could not locate UDF root directory\n"); > + return 2; > + } > + > + if (udf_get_logical_volume_id(p_udf, volume_id, sizeof(volume_id)) <= > 0) { > + fprintf(stderr, "UDF image %s has no logical volume ID\n", > + psz_fname); > + return 3; > + } > + printf("-- Volume id: %s\n", volume_id); > + > + udf_close(p_udf); > + > + return 0; > +} > -- > 1.7.4.4 > > >
