Fix cursheet tests for 'make distcheck'.
authorErik de Castro Lopo <erikd@mega-nerd.com>
Mon, 23 Feb 2015 08:42:30 +0000 (19:42 +1100)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Mon, 23 Feb 2015 19:06:10 +0000 (06:06 +1100)
src/test_grabbag/cuesheet/main.c
test/test_grabbag.sh

index 0e3c916..9ed9e4b 100644 (file)
@@ -32,7 +32,7 @@
 static int do_cuesheet(const char *infilename, unsigned sample_rate, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset)
 {
        FILE *fin, *fout;
-       const char *error_message;
+       const char *error_message, *tmpfilenamebase;
        char tmpfilename[4096];
        unsigned last_line_read;
        FLAC__StreamMetadata *cuesheet;
@@ -64,7 +64,11 @@ static int do_cuesheet(const char *infilename, unsigned sample_rate, FLAC__bool
                FLAC__metadata_object_delete(cuesheet);
                return 1;
        }
-       flac_snprintf(tmpfilename, sizeof (tmpfilename), "%s.1", infilename);
+
+       tmpfilenamebase = strstr(infilename, "cuesheets/");
+       tmpfilenamebase = tmpfilenamebase == NULL ? infilename : tmpfilenamebase;
+
+       flac_snprintf(tmpfilename, sizeof (tmpfilename), "%s.1", tmpfilenamebase);
        if(0 == (fout = flac_fopen(tmpfilename, "w"))) {
                fprintf(stderr, "can't open file %s for writing: %s\n", tmpfilename, strerror(errno));
                FLAC__metadata_object_delete(cuesheet);
@@ -96,7 +100,7 @@ static int do_cuesheet(const char *infilename, unsigned sample_rate, FLAC__bool
                FLAC__metadata_object_delete(cuesheet);
                return 1;
        }
-       flac_snprintf(tmpfilename, sizeof (tmpfilename), "%s.2", infilename);
+       flac_snprintf(tmpfilename, sizeof (tmpfilename), "%s.2", tmpfilenamebase);
        if(0 == (fout = flac_fopen(tmpfilename, "w"))) {
                fprintf(stderr, "can't open file %s for writing: %s\n", tmpfilename, strerror(errno));
                FLAC__metadata_object_delete(cuesheet);
index 627a9fa..4ba38f3 100755 (executable)
@@ -118,8 +118,9 @@ for cuesheet in $good_cuesheets ; do
        elif [ "$exit_code" != 0 ] ; then
                die "Error: good cuesheet is broken"
        fi
-       cuesheet_pass1=${cuesheet}.1
-       cuesheet_pass2=${cuesheet}.2
+       cuesheet_out=$(echo $cuesheet | sed "s|${top_srcdir}/test/||")
+       cuesheet_pass1=${cuesheet_out}.1
+       cuesheet_pass2=${cuesheet_out}.2
        diff $cuesheet_pass1 $cuesheet_pass2 >> $log 2>&1 || die "Error: pass1 and pass2 output differ"
        rm -f $cuesheet_pass1 $cuesheet_pass2
 done