tag 687405 + patch thanks Il 15/09/2012 11:08, Lucas Nussbaum ha scritto: >> All the failures appear related to the /tmp/test file with unrecognized >> audio file format. Lucas, could it be some strange configuration in your >> build environment (for example, /tmp not really available, or with >> limited space)? > > It shouldn't be the case. However, using '/tmp/test' is a bit fragile, > isn't it?
Ok, the attached patch should fix the problem. However, it is quite a complicated and hard to maintain patch for a rather minor thing (it is a FTBFS, but it happens only under certain conditions and it just a small technical issue in the testing platform). I don't feel comfortable with uploading it without hearing back from the maintainer. Giovanni. -- Giovanni Mascellani <mascell...@poisson.phc.unipi.it> Pisa, Italy Web: http://poisson.phc.unipi.it/~mascellani Jabber: g.mascell...@jabber.org / giova...@elabor.homelinux.org
Index: audiofile/test/miscellaneous.cpp =================================================================== --- audiofile.orig/test/miscellaneous.cpp 2012-09-15 18:47:55.747463233 +0200 +++ audiofile/test/miscellaneous.cpp 2012-09-15 19:42:52.563324587 +0200 @@ -50,7 +50,7 @@ const int kNumMiscellaneous = sizeof (kMiscellaneous) / sizeof (Miscellaneous); -const char kTestFileName[] = "/tmp/test"; +char kTestFileName[] = "/tmp/testXXXXXX"; void writeMiscellaneous(int fileFormat) { @@ -143,6 +143,7 @@ int main(int argc, char **argv) { + int tmp = mkstemp(kTestFileName); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } Index: audiofile/test/aes.cpp =================================================================== --- audiofile.orig/test/aes.cpp 2012-09-15 18:26:18.783517776 +0200 +++ audiofile/test/aes.cpp 2012-09-15 19:42:52.555324584 +0200 @@ -34,7 +34,7 @@ #include <string.h> #include <unistd.h> -static const char *kTestFileName = "/tmp/test.aiff"; +static char kTestFileName[] = "/tmp/test.aiffXXXXXX"; TEST(AES, AIFF) { @@ -68,6 +68,7 @@ int main(int argc, char **argv) { + int tmp = mkstemp(kTestFileName); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } Index: audiofile/test/channelmatrix.cpp =================================================================== --- audiofile.orig/test/channelmatrix.cpp 2012-09-15 18:26:18.783517776 +0200 +++ audiofile/test/channelmatrix.cpp 2012-09-15 19:42:52.559324586 +0200 @@ -30,7 +30,7 @@ #include <audiofile.h> #include <gtest/gtest.h> -const char *kTestFileName = "/tmp/test.aiff"; +char kTestFileName[] = "/tmp/test.aiffXXXXXX"; template <typename T> void testChannelMatrixReading(int sampleFormat, int sampleWidth) @@ -213,6 +213,7 @@ int main(int argc, char **argv) { + int tmp = mkstemp(kTestFileName); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } Index: audiofile/test/floattoint.cpp =================================================================== --- audiofile.orig/test/floattoint.cpp 2012-09-15 18:26:18.783517776 +0200 +++ audiofile/test/floattoint.cpp 2012-09-15 19:42:52.559324586 +0200 @@ -40,13 +40,14 @@ protected: virtual void SetUp() { + int tmp = mkstemp(FloatToIntTest::kTestFileName); } virtual void TearDown() { ::unlink(kTestFileName); } - static const char *kTestFileName; + static char kTestFileName[]; static AFfilehandle createTestFile(int sampleWidth) { @@ -67,7 +68,7 @@ } }; -const char *FloatToIntTest::kTestFileName = "/tmp/test.aiff"; +char FloatToIntTest::kTestFileName[] = "/tmp/test.aiffXXXXXX"; static const int8_t kMinInt8 = std::numeric_limits<int8_t>::min(); static const int8_t kMaxInt8 = std::numeric_limits<int8_t>::max(); Index: audiofile/test/inttofloat.cpp =================================================================== --- audiofile.orig/test/inttofloat.cpp 2012-09-15 18:26:18.787517776 +0200 +++ audiofile/test/inttofloat.cpp 2012-09-15 19:42:52.563324587 +0200 @@ -40,13 +40,14 @@ protected: virtual void SetUp() { + int tmp = mkstemp(IntToFloatTest::kTestFileName); } virtual void TearDown() { ::unlink(kTestFileName); } - static const char *kTestFileName; + static char kTestFileName[]; static AFfilehandle createTestFile(int sampleWidth) { @@ -66,7 +67,7 @@ } }; -const char *IntToFloatTest::kTestFileName = "/tmp/test.aiff"; +char IntToFloatTest::kTestFileName[] = "/tmp/test.aiffXXXXXX"; static const int8_t kMinInt8 = std::numeric_limits<int8_t>::min(); static const int8_t kMaxInt8 = std::numeric_limits<int8_t>::max(); Index: audiofile/test/large.cpp =================================================================== --- audiofile.orig/test/large.cpp 2012-09-15 18:26:18.787517776 +0200 +++ audiofile/test/large.cpp 2012-09-15 19:42:52.563324587 +0200 @@ -43,7 +43,7 @@ #include <stdlib.h> #include <unistd.h> -static const char *kTestFileName = "/tmp/audiofile-test"; +static char kTestFileName[] = "/tmp/audiofile-testXXXXXX"; void testLargeFile(int fileFormat) { @@ -143,6 +143,7 @@ int main (int argc, char **argv) { + int tmp = mkstemp(kTestFileName); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } Index: audiofile/test/loop.cpp =================================================================== --- audiofile.orig/test/loop.cpp 2012-09-15 18:26:18.787517776 +0200 +++ audiofile/test/loop.cpp 2012-09-15 19:42:52.563324587 +0200 @@ -38,7 +38,7 @@ #include <sys/types.h> #include <unistd.h> -const char *kTestFileName = "/tmp/test.aiff"; +char kTestFileName[] = "/tmp/test.aiffXXXXXX"; TEST(Loop, AIFF) { @@ -131,6 +131,7 @@ int main(int argc, char **argv) { + int tmp = mkstemp(kTestFileName); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } Index: audiofile/test/next.cpp =================================================================== --- audiofile.orig/test/next.cpp 2012-09-15 18:26:18.787517776 +0200 +++ audiofile/test/next.cpp 2012-09-15 19:42:52.563324587 +0200 @@ -77,7 +77,7 @@ const int16_t kFrames[] = { 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 }; const int kFrameCount = sizeof (kFrames) / sizeof (kFrames[0]); -const char *kTestFileName = "/tmp/test.au"; +char kTestFileName[] = "/tmp/test.auXXXXXX"; TEST(NeXT, UnspecifiedLength) { @@ -147,6 +147,7 @@ int main(int argc, char **argv) { + int tmp = mkstemp(kTestFileName); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } Index: audiofile/test/pcmdata.cpp =================================================================== --- audiofile.orig/test/pcmdata.cpp 2012-09-15 18:26:18.787517776 +0200 +++ audiofile/test/pcmdata.cpp 2012-09-15 19:42:52.563324587 +0200 @@ -40,7 +40,7 @@ #include <unistd.h> #include <climits> -static const char *kTestFileName = "/tmp/testaf"; +static char kTestFileName[] = "/tmp/testafXXXXXX"; template <typename T, int kSampleFormat, int kBitsPerSample> void runTest(int fileFormat) @@ -187,6 +187,7 @@ int main (int argc, char **argv) { + int tmp = mkstemp(kTestFileName); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } Index: audiofile/test/pcmmapping.cpp =================================================================== --- audiofile.orig/test/pcmmapping.cpp 2012-09-15 18:26:18.787517776 +0200 +++ audiofile/test/pcmmapping.cpp 2012-09-15 19:42:52.563324587 +0200 @@ -38,13 +38,14 @@ protected: virtual void SetUp() { + int tmp = mkstemp(PCMMappingTest::kTestFileName); } virtual void TearDown() { ::unlink(kTestFileName); } - static const char *kTestFileName; + static char kTestFileName[]; static AFfilehandle createTestFile(int sampleFormat, int sampleWidth) { @@ -63,7 +64,7 @@ } }; -const char *PCMMappingTest::kTestFileName = "/tmp/test.aiff"; +char PCMMappingTest::kTestFileName[] = "/tmp/test.aiffXXXXXX"; TEST_F(PCMMappingTest, Float) { Index: audiofile/test/seek.cpp =================================================================== --- audiofile.orig/test/seek.cpp 2012-09-15 18:26:18.787517776 +0200 +++ audiofile/test/seek.cpp 2012-09-15 19:42:52.563324587 +0200 @@ -37,7 +37,7 @@ #include <gtest/gtest.h> #include <audiofile.h> -static const char *kTestFileName = "/tmp/test.aiff"; +static char kTestFileName[] = "/tmp/test.aiffXXXXXX"; TEST(Seek, Seek) { @@ -105,6 +105,7 @@ int main (int argc, char **argv) { + int tmp = mkstemp(kTestFileName); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } Index: audiofile/test/sign.cpp =================================================================== --- audiofile.orig/test/sign.cpp 2012-09-15 18:26:18.787517776 +0200 +++ audiofile/test/sign.cpp 2012-09-15 19:42:52.563324587 +0200 @@ -40,13 +40,14 @@ protected: virtual void SetUp() { + int tmp = mkstemp(SignConversionTest::kTestFileName); } virtual void TearDown() { ::unlink(kTestFileName); } - static const char *kTestFileName; + static char kTestFileName[]; static AFfilehandle createTestFile(int sampleWidth) { @@ -66,7 +67,7 @@ } }; -const char *SignConversionTest::kTestFileName = "/tmp/test.aiff"; +char SignConversionTest::kTestFileName[] = "/tmp/test.aiffXXXXXX"; static const int8_t kMinInt8 = std::numeric_limits<int8_t>::min(); static const int8_t kMaxInt8 = std::numeric_limits<int8_t>::max(); Index: audiofile/test/virtualfile.cpp =================================================================== --- audiofile.orig/test/virtualfile.cpp 2012-09-15 18:26:18.787517776 +0200 +++ audiofile/test/virtualfile.cpp 2012-09-15 19:42:52.567324588 +0200 @@ -97,7 +97,7 @@ return vf; } -static const char *kTestFileName = "/tmp/aftest"; +static char kTestFileName[] = "/tmp/aftestXXXXXX"; TEST(VirtualFile, ReadVirtual) { @@ -173,6 +173,7 @@ int main(int argc, char **argv) { + int tmp = mkstemp(kTestFileName); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } Index: audiofile/test/floatto24.c =================================================================== --- audiofile.orig/test/floatto24.c 2012-09-15 19:27:47.223362660 +0200 +++ audiofile/test/floatto24.c 2012-09-15 19:44:13.023321204 +0200 @@ -36,8 +36,10 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <string.h> -#define TEST_FILE "/tmp/test.sf" +#define TEST_FILE "/tmp/test.sfXXXXXX" +char *real_test_file; /* When converted to samples with width 24 bits, the samples @@ -85,7 +87,10 @@ afInitChannels(setup, AF_DEFAULT_TRACK, 1); afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_FLOAT, 32); - AFfilehandle file = afOpenFile(TEST_FILE, "w", setup); + real_test_file = malloc(sizeof(TEST_FILE)); + strcpy(real_test_file, TEST_FILE); + int tmp = mkstemp(real_test_file); + AFfilehandle file = afOpenFile(real_test_file, "w", setup); if (file == AF_NULL_FILEHANDLE) { printf("could not open file for writing\n"); @@ -109,7 +114,7 @@ exit(EXIT_FAILURE); } - file = afOpenFile(TEST_FILE, "r", AF_NULL_FILESETUP); + file = afOpenFile(real_test_file, "r", AF_NULL_FILESETUP); if (file == AF_NULL_FILEHANDLE) { fprintf(stderr, "Could not open file for writing.\n"); @@ -173,7 +178,7 @@ exit(EXIT_FAILURE); } - unlink(TEST_FILE); + unlink(real_test_file); exit(EXIT_SUCCESS); } Index: audiofile/test/sixteen-to-eight.c =================================================================== --- audiofile.orig/test/sixteen-to-eight.c 2012-09-15 19:27:47.223362660 +0200 +++ audiofile/test/sixteen-to-eight.c 2012-09-15 19:42:52.567324588 +0200 @@ -38,7 +38,8 @@ #include <audiofile.h> -#define TEST_FILE "/tmp/test.wave" +#define TEST_FILE "/tmp/test.waveXXXXXX" +char *real_test_file; int main (int argc, char **argv) { @@ -57,7 +58,10 @@ afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_UNSIGNED, 8); afInitChannels(setup, AF_DEFAULT_TRACK, 1); - file = afOpenFile(TEST_FILE, "w", setup); + real_test_file = malloc(sizeof(TEST_FILE)); + strcpy(real_test_file, TEST_FILE); + int tmp = mkstemp(real_test_file); + file = afOpenFile(real_test_file, "w", setup); if (file == AF_NULL_FILEHANDLE) { fprintf(stderr, "could not open file for writing\n"); @@ -72,7 +76,7 @@ afCloseFile(file); - file = afOpenFile(TEST_FILE, "r", AF_NULL_FILESETUP); + file = afOpenFile(real_test_file, "r", AF_NULL_FILESETUP); if (file == AF_NULL_FILEHANDLE) { fprintf(stderr, "could not open file for reading\n"); @@ -105,7 +109,7 @@ } afCloseFile(file); - unlink(TEST_FILE); + unlink(real_test_file); exit(EXIT_SUCCESS); } Index: audiofile/test/testchannelmatrix.c =================================================================== --- audiofile.orig/test/testchannelmatrix.c 2012-09-15 19:27:47.223362660 +0200 +++ audiofile/test/testchannelmatrix.c 2012-09-15 19:42:52.567324588 +0200 @@ -37,7 +37,8 @@ #include <audiofile.h> -#define TEST_FILE "/tmp/test.aiff" +#define TEST_FILE "/tmp/test.aiffXXXXXX" +char *real_test_file; const short samples[] = {300, -300, 515, -515, 2315, -2315, 9154, -9154}; #define SAMPLE_COUNT (sizeof (samples) / sizeof (short)) @@ -45,7 +46,7 @@ void cleanup (void) { - unlink(TEST_FILE); + unlink(real_test_file); } void ensure (int condition, const char *message) @@ -74,7 +75,10 @@ afInitFileFormat(setup, AF_FILE_AIFFC); /* Write stereo data to test file. */ - file = afOpenFile(TEST_FILE, "w", setup); + real_test_file = malloc(sizeof(TEST_FILE)); + strcpy(real_test_file, TEST_FILE); + int tmp = mkstemp(real_test_file); + file = afOpenFile(real_test_file, "w", setup); ensure(file != AF_NULL_FILEHANDLE, "could not open file for writing"); afFreeFileSetup(setup); @@ -95,7 +99,7 @@ corresponding even sample, the data read should be all zeros. */ - file = afOpenFile(TEST_FILE, "r", AF_NULL_FILESETUP); + file = afOpenFile(real_test_file, "r", AF_NULL_FILESETUP); ensure(file != AF_NULL_FILEHANDLE, "could not open file for reading"); ensure(afGetChannels(file, AF_DEFAULT_TRACK) == 2, Index: audiofile/test/testdouble.c =================================================================== --- audiofile.orig/test/testdouble.c 2012-09-15 19:27:47.223362660 +0200 +++ audiofile/test/testdouble.c 2012-09-15 19:42:52.567324588 +0200 @@ -36,7 +36,8 @@ #include <audiofile.h> -#define TEST_FILE "/tmp/test.double" +#define TEST_FILE "/tmp/test.doubleXXXXXX" +char *real_test_file; const double samples[] = {1.0, 0.6, -0.3, 0.95, 0.2, -0.6, 0.9, 0.4, -0.22, 0.125, 0.1, -0.4}; @@ -46,7 +47,7 @@ void cleanup (void) { - unlink(TEST_FILE); + unlink(real_test_file); } void ensure (int condition, const char *message) @@ -94,7 +95,10 @@ afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_DOUBLE, 64); afInitChannels(setup, AF_DEFAULT_TRACK, 2); - file = afOpenFile(TEST_FILE, "w", setup); + real_test_file = malloc(sizeof(TEST_FILE)); + strcpy(real_test_file, TEST_FILE); + int tmp = mkstemp(real_test_file); + file = afOpenFile(real_test_file, "w", setup); ensure(file != AF_NULL_FILEHANDLE, "could not open file for writing"); afFreeFileSetup(setup); @@ -105,7 +109,7 @@ ensure(afCloseFile(file) == 0, "error closing file"); - file = afOpenFile(TEST_FILE, "r", AF_NULL_FILESETUP); + file = afOpenFile(real_test_file, "r", AF_NULL_FILESETUP); ensure(file != AF_NULL_FILEHANDLE, "could not open file for reading"); ensure(afGetChannels(file, AF_DEFAULT_TRACK) == 2, Index: audiofile/test/testfloat.c =================================================================== --- audiofile.orig/test/testfloat.c 2012-09-15 19:27:47.223362660 +0200 +++ audiofile/test/testfloat.c 2012-09-15 19:42:52.567324588 +0200 @@ -36,7 +36,8 @@ #include <audiofile.h> -#define TEST_FILE "/tmp/test.float" +#define TEST_FILE "/tmp/test.floatXXXXXX" +char *real_test_file; const float samples[] = {1.0, 0.6, -0.3, 0.95, 0.2, -0.6, 0.9, 0.4, -0.22, 0.125, 0.1, -0.4}; @@ -46,7 +47,7 @@ void cleanup (void) { - unlink(TEST_FILE); + unlink(real_test_file); } void ensure (int condition, const char *message) @@ -94,7 +95,10 @@ afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_FLOAT, 32); afInitChannels(setup, AF_DEFAULT_TRACK, 2); - file = afOpenFile(TEST_FILE, "w", setup); + real_test_file = malloc(sizeof(TEST_FILE)); + strcpy(real_test_file, TEST_FILE); + int tmp = mkstemp(real_test_file); + file = afOpenFile(real_test_file, "w", setup); ensure(file != AF_NULL_FILEHANDLE, "could not open file for writing"); afFreeFileSetup(setup); @@ -105,7 +109,7 @@ ensure(afCloseFile(file) == 0, "error closing file"); - file = afOpenFile(TEST_FILE, "r", AF_NULL_FILESETUP); + file = afOpenFile(real_test_file, "r", AF_NULL_FILESETUP); ensure(file != AF_NULL_FILEHANDLE, "could not open file for reading"); ensure(afGetChannels(file, AF_DEFAULT_TRACK) == 2, Index: audiofile/test/testmarkers.c =================================================================== --- audiofile.orig/test/testmarkers.c 2012-09-15 19:27:47.223362660 +0200 +++ audiofile/test/testmarkers.c 2012-09-15 19:42:52.571324588 +0200 @@ -30,14 +30,15 @@ #include <audiofile.h> -#define TEST_FILE "/tmp/markers.test" +#define TEST_FILE "/tmp/markers.testXXXXXX" +char *real_test_file; #define FRAME_COUNT 200 void cleanup (void) { #ifndef DEBUG - unlink(TEST_FILE); + unlink(real_test_file); #endif } @@ -76,7 +77,10 @@ afInitMarkName(setup, AF_DEFAULT_TRACK, markids[2], marknames[2]); afInitMarkName(setup, AF_DEFAULT_TRACK, markids[3], marknames[3]); - file = afOpenFile(TEST_FILE, "w", setup); + real_test_file = malloc(sizeof(TEST_FILE)); + strcpy(real_test_file, TEST_FILE); + int tmp = mkstemp(real_test_file); + file = afOpenFile(real_test_file, "w", setup); ensure(file != AF_NULL_FILEHANDLE, "Could not open file for writing"); afFreeFileSetup(setup); @@ -91,7 +95,7 @@ afCloseFile(file); - file = afOpenFile(TEST_FILE, "r", NULL); + file = afOpenFile(real_test_file, "r", NULL); ensure(file != AF_NULL_FILEHANDLE, "Could not open file for reading"); readmarkcount = afGetMarkIDs(file, AF_DEFAULT_TRACK, NULL); Index: audiofile/test/twentyfour.c =================================================================== --- audiofile.orig/test/twentyfour.c 2012-09-15 19:27:47.223362660 +0200 +++ audiofile/test/twentyfour.c 2012-09-15 19:42:52.571324588 +0200 @@ -40,7 +40,8 @@ #include <audiofile.h> -#define TEST_FILE "/tmp/test.aiff" +#define TEST_FILE "/tmp/test.aiffXXXXXX" +char *real_test_file; #define FRAME_COUNT 6 int main (int argc, char **argv) @@ -70,7 +71,10 @@ afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 24); afInitChannels(setup, AF_DEFAULT_TRACK, 1); - file = afOpenFile(TEST_FILE, "w", setup); + real_test_file = malloc(sizeof(TEST_FILE)); + strcpy(real_test_file, TEST_FILE); + int tmp = mkstemp(real_test_file); + file = afOpenFile(real_test_file, "w", setup); if (file == AF_NULL_FILEHANDLE) { fprintf(stderr, "could not open file for writing\n"); @@ -84,7 +88,7 @@ afCloseFile(file); - file = afOpenFile(TEST_FILE, "r", AF_NULL_FILESETUP); + file = afOpenFile(real_test_file, "r", AF_NULL_FILESETUP); if (file == AF_NULL_FILEHANDLE) { fprintf(stderr, "could not open file for reading\n"); @@ -230,7 +234,7 @@ fprintf(stderr, "Error closing file.\n"); exit(EXIT_FAILURE); } - unlink(TEST_FILE); + unlink(real_test_file); exit(EXIT_SUCCESS); } Index: audiofile/test/twentyfour2.c =================================================================== --- audiofile.orig/test/twentyfour2.c 2012-09-15 19:27:24.539363616 +0200 +++ audiofile/test/twentyfour2.c 2012-09-15 19:42:52.571324588 +0200 @@ -43,13 +43,14 @@ #include <audiofile.h> -#define TEST_FILE "/tmp/test.aiff" +#define TEST_FILE "/tmp/test.aiffXXXXXX" +char *real_test_file; #define FRAME_COUNT 10000 void cleanup (void) { #ifndef DEBUG - unlink(TEST_FILE); + unlink(real_test_file); #endif } @@ -75,7 +76,10 @@ afInitChannels(setup, AF_DEFAULT_TRACK, 1); afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 24); - file = afOpenFile(TEST_FILE, "w", setup); + real_test_file = malloc(sizeof(TEST_FILE)); + strcpy(real_test_file, TEST_FILE); + int tmp = mkstemp(real_test_file); + file = afOpenFile(real_test_file, "w", setup); ensure(file != NULL, "could not open test file for writing"); afFreeFileSetup(setup); @@ -103,7 +107,7 @@ Now open file for reading and ensure that the data read is equal to the data written. */ - file = afOpenFile(TEST_FILE, "r", AF_NULL_FILESETUP); + file = afOpenFile(real_test_file, "r", AF_NULL_FILESETUP); ensure(file != NULL, "could not open test file for reading"); framesread = afReadFrames(file, AF_DEFAULT_TRACK, readbuffer, FRAME_COUNT); Index: audiofile/test/writealaw.c =================================================================== --- audiofile.orig/test/writealaw.c 2012-09-15 19:27:47.223362660 +0200 +++ audiofile/test/writealaw.c 2012-09-15 19:42:52.571324588 +0200 @@ -51,7 +51,8 @@ #include <stdlib.h> #include <unistd.h> -#define TEST_FILE "/tmp/test.alaw" +#define TEST_FILE "/tmp/test.alawXXXXXX" +char *real_test_file; #define FRAME_COUNT 16 #define SAMPLE_COUNT FRAME_COUNT @@ -61,7 +62,7 @@ void cleanup (void) { #ifndef DEBUG - unlink(TEST_FILE); + unlink(real_test_file); #endif } @@ -111,7 +112,10 @@ afInitFileFormat(setup, fileFormat); afInitChannels(setup, AF_DEFAULT_TRACK, 1); - file = afOpenFile(TEST_FILE, "w", setup); + real_test_file = malloc(sizeof(TEST_FILE)); + strcpy(real_test_file, TEST_FILE); + int tmp = mkstemp(real_test_file); + file = afOpenFile(real_test_file, "w", setup); afFreeFileSetup(setup); ensure(afGetCompression(file, AF_DEFAULT_TRACK) == @@ -128,7 +132,7 @@ afCloseFile(file); /* Open the file for reading and verify the data. */ - file = afOpenFile(TEST_FILE, "r", NULL); + file = afOpenFile(real_test_file, "r", NULL); ensure(file != AF_NULL_FILEHANDLE, "unable to open file for reading"); ensure(afGetFileFormat(file, NULL) == fileFormat, Index: audiofile/test/writeraw.c =================================================================== --- audiofile.orig/test/writeraw.c 2012-09-15 19:27:47.223362660 +0200 +++ audiofile/test/writeraw.c 2012-09-15 19:42:52.571324588 +0200 @@ -42,12 +42,13 @@ #include <stdlib.h> #include <unistd.h> -#define TEST_FILE "/tmp/test.raw" +#define TEST_FILE "/tmp/test.rawXXXXXX" +char *real_test_file; void cleanup (void) { #ifndef DEBUG - unlink(TEST_FILE); + unlink(real_test_file); #endif } @@ -82,7 +83,10 @@ afInitChannels(setup, AF_DEFAULT_TRACK, 1); afInitSampleFormat(setup, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16); - file = afOpenFile(TEST_FILE, "w", setup); + real_test_file = malloc(sizeof(TEST_FILE)); + strcpy(real_test_file, TEST_FILE); + int tmp = mkstemp(real_test_file); + file = afOpenFile(real_test_file, "w", setup); ensure(file != AF_NULL_FILEHANDLE, "unable to open file for writing"); framesWritten = afWriteFrames(file, AF_DEFAULT_TRACK, samples, 8); @@ -91,7 +95,7 @@ ensure(afCloseFile(file) == 0, "error closing file"); - file = afOpenFile(TEST_FILE, "r", setup); + file = afOpenFile(real_test_file, "r", setup); ensure(file != AF_NULL_FILEHANDLE, "unable to open file for reading"); afFreeFileSetup(setup); Index: audiofile/test/writeulaw.c =================================================================== --- audiofile.orig/test/writeulaw.c 2012-09-15 19:27:47.223362660 +0200 +++ audiofile/test/writeulaw.c 2012-09-15 19:42:52.571324588 +0200 @@ -51,7 +51,8 @@ #include <stdlib.h> #include <unistd.h> -#define TEST_FILE "/tmp/test.ulaw" +#define TEST_FILE "/tmp/test.ulawXXXXXX" +char *real_test_file; #define FRAME_COUNT 16 #define SAMPLE_COUNT FRAME_COUNT @@ -61,7 +62,7 @@ void cleanup (void) { #ifndef DEBUG - unlink(TEST_FILE); + unlink(real_test_file); #endif } @@ -111,7 +112,10 @@ afInitFileFormat(setup, fileFormat); afInitChannels(setup, AF_DEFAULT_TRACK, 1); - file = afOpenFile(TEST_FILE, "w", setup); + real_test_file = malloc(sizeof(TEST_FILE)); + strcpy(real_test_file, TEST_FILE); + int tmp = mkstemp(real_test_file); + file = afOpenFile(real_test_file, "w", setup); afFreeFileSetup(setup); ensure(afGetCompression(file, AF_DEFAULT_TRACK) == @@ -128,7 +132,7 @@ afCloseFile(file); /* Open the file for reading and verify the data. */ - file = afOpenFile(TEST_FILE, "r", NULL); + file = afOpenFile(real_test_file, "r", NULL); ensure(file != AF_NULL_FILEHANDLE, "unable to open file for reading"); ensure(afGetFileFormat(file, NULL) == fileFormat,
signature.asc
Description: OpenPGP digital signature
_______________________________________________ pkg-multimedia-maintainers mailing list pkg-multimedia-maintainers@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-multimedia-maintainers