[SCM] audiofile/master: Under certain conditions, tests would fail as /tmp/test might not be writeable.

alessio at users.alioth.debian.org alessio at users.alioth.debian.org
Sun Oct 14 11:23:30 UTC 2012


The following commit has been merged in the master branch:
commit 486aeb27b7f90156753a68475c3c14608c141837
Author: Alessio Treglia <alessio at debian.org>
Date:   Sun Oct 14 12:20:30 2012 +0100

    Under certain conditions, tests would fail as /tmp/test might not be writeable.
    
    Closes: #687405
    Thanks: Giovanni Mascellani for the great work.

diff --git a/debian/patches/0001-ftbfs_tmp_unique_fnames.patch b/debian/patches/0001-ftbfs_tmp_unique_fnames.patch
new file mode 100644
index 0000000..c6738b0
--- /dev/null
+++ b/debian/patches/0001-ftbfs_tmp_unique_fnames.patch
@@ -0,0 +1,767 @@
+Description: Fix FTBFS when /tmp/test is not writeable.
+Author: Giovanni Mascellani <gio at debian.org>
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=687405
+---
+ test/aes.cpp             |    3 ++-
+ test/channelmatrix.cpp   |    3 ++-
+ test/floatto24.c         |   13 +++++++++----
+ test/floattoint.cpp      |    5 +++--
+ test/inttofloat.cpp      |    5 +++--
+ test/large.cpp           |    3 ++-
+ test/loop.cpp            |    3 ++-
+ test/miscellaneous.cpp   |    3 ++-
+ test/next.cpp            |    3 ++-
+ test/pcmdata.cpp         |    3 ++-
+ test/pcmmapping.cpp      |    5 +++--
+ test/seek.cpp            |    3 ++-
+ test/sign.cpp            |    5 +++--
+ test/sixteen-to-eight.c  |   12 ++++++++----
+ test/testchannelmatrix.c |   12 ++++++++----
+ test/testdouble.c        |   12 ++++++++----
+ test/testfloat.c         |   12 ++++++++----
+ test/testmarkers.c       |   12 ++++++++----
+ test/twentyfour.c        |   12 ++++++++----
+ test/twentyfour2.c       |   12 ++++++++----
+ test/virtualfile.cpp     |    3 ++-
+ test/writealaw.c         |   12 ++++++++----
+ test/writeraw.c          |   12 ++++++++----
+ test/writeulaw.c         |   12 ++++++++----
+ 24 files changed, 119 insertions(+), 61 deletions(-)
+
+--- audiofile.orig/test/miscellaneous.cpp
++++ audiofile/test/miscellaneous.cpp
+@@ -50,7 +50,7 @@ const Miscellaneous kMiscellaneous[] =
+ 
+ const int kNumMiscellaneous = sizeof (kMiscellaneous) / sizeof (Miscellaneous);
+ 
+-const char kTestFileName[] = "/tmp/test";
++char kTestFileName[] = "/tmp/testXXXXXX";
+ 
+ void writeMiscellaneous(int fileFormat)
+ {
+@@ -143,6 +143,7 @@ TEST(Miscellaneous, IFF_8SVX)
+ 
+ int main(int argc, char **argv)
+ {
++	int tmp = mkstemp(kTestFileName);
+ 	::testing::InitGoogleTest(&argc, argv);
+ 	return RUN_ALL_TESTS();
+ }
+--- audiofile.orig/test/aes.cpp
++++ audiofile/test/aes.cpp
+@@ -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 @@ TEST(AES, AIFF)
+ 
+ int main(int argc, char **argv)
+ {
++	int tmp = mkstemp(kTestFileName);
+ 	::testing::InitGoogleTest(&argc, argv);
+ 	return RUN_ALL_TESTS();
+ }
+--- audiofile.orig/test/channelmatrix.cpp
++++ audiofile/test/channelmatrix.cpp
+@@ -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 @@ TEST(ChannelMatrix, WriteDouble)
+ 
+ int main(int argc, char **argv)
+ {
++	int tmp = mkstemp(kTestFileName);
+ 	::testing::InitGoogleTest(&argc, argv);
+ 	return RUN_ALL_TESTS();
+ }
+--- audiofile.orig/test/floattoint.cpp
++++ audiofile/test/floattoint.cpp
+@@ -40,13 +40,14 @@ class FloatToIntTest : public testing::T
+ 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 @@ protected:
+ 	}
+ };
+ 
+-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();
+--- audiofile.orig/test/inttofloat.cpp
++++ audiofile/test/inttofloat.cpp
+@@ -40,13 +40,14 @@ class IntToFloatTest : public testing::T
+ 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 @@ protected:
+ 	}
+ };
+ 
+-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();
+--- audiofile.orig/test/large.cpp
++++ audiofile/test/large.cpp
+@@ -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 @@ TEST(Large, CAF)
+ 
+ int main (int argc, char **argv)
+ {
++	int tmp = mkstemp(kTestFileName);
+ 	::testing::InitGoogleTest(&argc, argv);
+ 	return RUN_ALL_TESTS();
+ }
+--- audiofile.orig/test/loop.cpp
++++ audiofile/test/loop.cpp
+@@ -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 @@ TEST(Loop, AIFF)
+ 
+ int main(int argc, char **argv)
+ {
++	int tmp = mkstemp(kTestFileName);
+ 	::testing::InitGoogleTest(&argc, argv);
+ 	return RUN_ALL_TESTS();
+ }
+--- audiofile.orig/test/next.cpp
++++ audiofile/test/next.cpp
+@@ -77,7 +77,7 @@ const char kDataTruncated[] =
+ 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 @@ TEST(NeXT, Truncated)
+ 
+ int main(int argc, char **argv)
+ {
++	int tmp = mkstemp(kTestFileName);
+ 	::testing::InitGoogleTest(&argc, argv);
+ 	return RUN_ALL_TESTS();
+ }
+--- audiofile.orig/test/pcmdata.cpp
++++ audiofile/test/pcmdata.cpp
+@@ -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 @@ TEST(CAF, Double) { testFloat64(AF_FILE_
+ 
+ int main (int argc, char **argv)
+ {
++	int tmp = mkstemp(kTestFileName);
+ 	::testing::InitGoogleTest(&argc, argv);
+ 	return RUN_ALL_TESTS();
+ }
+--- audiofile.orig/test/pcmmapping.cpp
++++ audiofile/test/pcmmapping.cpp
+@@ -38,13 +38,14 @@ class PCMMappingTest : public testing::T
+ 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 @@ protected:
+ 	}
+ };
+ 
+-const char *PCMMappingTest::kTestFileName = "/tmp/test.aiff";
++char PCMMappingTest::kTestFileName[] = "/tmp/test.aiffXXXXXX";
+ 
+ TEST_F(PCMMappingTest, Float)
+ {
+--- audiofile.orig/test/seek.cpp
++++ audiofile/test/seek.cpp
+@@ -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 @@ TEST(Seek, Seek)
+ 
+ int main (int argc, char **argv)
+ {
++	int tmp = mkstemp(kTestFileName);
+ 	::testing::InitGoogleTest(&argc, argv);
+ 	return RUN_ALL_TESTS();
+ }
+--- audiofile.orig/test/sign.cpp
++++ audiofile/test/sign.cpp
+@@ -40,13 +40,14 @@ class SignConversionTest : public testin
+ 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 @@ protected:
+ 	}
+ };
+ 
+-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();
+--- audiofile.orig/test/virtualfile.cpp
++++ audiofile/test/virtualfile.cpp
+@@ -97,7 +97,7 @@ static AFvirtualfile *vf_create(FILE *fp
+ 	return vf;
+ }
+ 
+-static const char *kTestFileName = "/tmp/aftest";
++static char kTestFileName[] = "/tmp/aftestXXXXXX";
+ 
+ TEST(VirtualFile, ReadVirtual)
+ {
+@@ -173,6 +173,7 @@ TEST(VirtualFile, WriteVirtual)
+ 
+ int main(int argc, char **argv)
+ {
++	int tmp = mkstemp(kTestFileName);
+ 	::testing::InitGoogleTest(&argc, argv);
+ 	return RUN_ALL_TESTS();
+ }
+--- audiofile.orig/test/floatto24.c
++++ audiofile/test/floatto24.c
+@@ -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 @@ int main (int argc, char **argv)
+ 	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 @@ int main (int argc, char **argv)
+ 		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 @@ int main (int argc, char **argv)
+ 		exit(EXIT_FAILURE);
+ 	}
+ 
+-	unlink(TEST_FILE);
++	unlink(real_test_file);
+ 
+ 	exit(EXIT_SUCCESS);
+ }
+--- audiofile.orig/test/sixteen-to-eight.c
++++ audiofile/test/sixteen-to-eight.c
+@@ -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 @@ int main (int argc, char **argv)
+ 	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 @@ int main (int argc, char **argv)
+ 
+ 	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 @@ int main (int argc, char **argv)
+ 	}
+ 
+ 	afCloseFile(file);
+-	unlink(TEST_FILE);
++	unlink(real_test_file);
+ 
+ 	exit(EXIT_SUCCESS);
+ }
+--- audiofile.orig/test/testchannelmatrix.c
++++ audiofile/test/testchannelmatrix.c
+@@ -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 @@ const short samples[] = {300, -300, 515,
+ 
+ void cleanup (void)
+ {
+-	unlink(TEST_FILE);
++	unlink(real_test_file);
+ }
+ 
+ void ensure (int condition, const char *message)
+@@ -74,7 +75,10 @@ int main (void)
+ 	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 @@ int main (void)
+ 		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,
+--- audiofile.orig/test/testdouble.c
++++ audiofile/test/testdouble.c
+@@ -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 testdouble (int fileFormat);
+ 
+ void cleanup (void)
+ {
+-	unlink(TEST_FILE);
++	unlink(real_test_file);
+ }
+ 
+ void ensure (int condition, const char *message)
+@@ -94,7 +95,10 @@ void testdouble (int fileFormat)
+ 	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 @@ void testdouble (int fileFormat)
+ 
+ 	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,
+--- audiofile.orig/test/testfloat.c
++++ audiofile/test/testfloat.c
+@@ -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 testfloat (int fileFormat);
+ 
+ void cleanup (void)
+ {
+-	unlink(TEST_FILE);
++	unlink(real_test_file);
+ }
+ 
+ void ensure (int condition, const char *message)
+@@ -94,7 +95,10 @@ void testfloat (int fileFormat)
+ 	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 @@ void testfloat (int fileFormat)
+ 
+ 	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,
+--- audiofile.orig/test/testmarkers.c
++++ audiofile/test/testmarkers.c
+@@ -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 @@ int testmarkers (int fileformat)
+ 	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 @@ int testmarkers (int fileformat)
+ 
+ 	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);
+--- audiofile.orig/test/twentyfour.c
++++ audiofile/test/twentyfour.c
+@@ -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 @@ int main (int argc, char **argv)
+ 	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 @@ int main (int argc, char **argv)
+ 
+ 	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 @@ int main (int argc, char **argv)
+ 		fprintf(stderr, "Error closing file.\n");
+ 		exit(EXIT_FAILURE);
+ 	}
+-	unlink(TEST_FILE);
++	unlink(real_test_file);
+ 
+ 	exit(EXIT_SUCCESS);
+ }
+--- audiofile.orig/test/twentyfour2.c
++++ audiofile/test/twentyfour2.c
+@@ -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 @@ int main (void)
+ 	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 @@ int main (void)
+ 		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);
+--- audiofile.orig/test/writealaw.c
++++ audiofile/test/writealaw.c
+@@ -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 testalaw (int fileFormat);
+ void cleanup (void)
+ {
+ #ifndef DEBUG
+-	unlink(TEST_FILE);
++	unlink(real_test_file);
+ #endif
+ }
+ 
+@@ -111,7 +112,10 @@ void testalaw (int fileFormat)
+ 	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 @@ void testalaw (int fileFormat)
+ 	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,
+--- audiofile.orig/test/writeraw.c
++++ audiofile/test/writeraw.c
+@@ -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 @@ int main (int argc, char **argv)
+ 	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 @@ int main (int argc, char **argv)
+ 
+ 	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);
+ 
+--- audiofile.orig/test/writeulaw.c
++++ audiofile/test/writeulaw.c
+@@ -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 testulaw (int fileFormat);
+ void cleanup (void)
+ {
+ #ifndef DEBUG
+-	unlink(TEST_FILE);
++	unlink(real_test_file);
+ #endif
+ }
+ 
+@@ -111,7 +112,10 @@ void testulaw (int fileFormat)
+ 	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 @@ void testulaw (int fileFormat)
+ 	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,
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..74a5baa
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-ftbfs_tmp_unique_fnames.patch

-- 
audiofile packaging



More information about the pkg-multimedia-commits mailing list