This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[COMMITTED] tests: All update tests should use unique temporary file names and cleanup.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Sun, 28 Apr 2013 01:02:34 +0200
- Subject: [COMMITTED] tests: All update tests should use unique temporary file names and cleanup.
All update tests used the same temporary file name xxx. And only update4
would clean up this file. Now that tests can run in parallel make sure
all temporary names are unique and every test cleans up their own files.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
tests/ChangeLog | 7 +++++++
tests/update1.c | 5 ++++-
tests/update2.c | 5 ++++-
tests/update3.c | 5 ++++-
tests/update4.c | 2 +-
5 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/tests/ChangeLog b/tests/ChangeLog
index dfee832..e6722da 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,12 @@
2013-04-27 Mark Wielaard <mjw@redhat.com>
+ * update1.c (main): Use unique tempfile name and unlink file.
+ * update2.c (main): Likewise.
+ * update3.c (main): Likewise.
+ * update4.c (main): Use unique tempfile name.
+
+2013-04-27 Mark Wielaard <mjw@redhat.com>
+
* run-alldts.sh: Add testfile-alldts to tempfiles.
* run-elf_cntl_gelf_getshdr.sh: Add test_shdr.out to tempfiles.
* run-macro-test.sh: Add readelf.macros.out to tempfiles.
diff --git a/tests/update1.c b/tests/update1.c
index 9e40686..f4c1475 100644
--- a/tests/update1.c
+++ b/tests/update1.c
@@ -26,12 +26,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
int
main (int argc, char *argv[] __attribute__ ((unused)))
{
- const char *fname = "xxx";
+ const char *fname = "xxx_update1";
int fd;
Elf *elf;
Elf32_Ehdr *ehdr;
@@ -120,5 +121,7 @@ main (int argc, char *argv[] __attribute__ ((unused)))
exit (1);
}
+ unlink (fname);
+
return 0;
}
diff --git a/tests/update2.c b/tests/update2.c
index 4232694..5805163 100644
--- a/tests/update2.c
+++ b/tests/update2.c
@@ -26,12 +26,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
int
main (int argc, char *argv[] __attribute__ ((unused)))
{
- const char *fname = "xxx";
+ const char *fname = "xxx_update2";
int fd;
Elf *elf;
Elf32_Ehdr *ehdr;
@@ -143,5 +144,7 @@ main (int argc, char *argv[] __attribute__ ((unused)))
exit (1);
}
+ unlink (fname);
+
return 0;
}
diff --git a/tests/update3.c b/tests/update3.c
index 1a62b34..d760687 100644
--- a/tests/update3.c
+++ b/tests/update3.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include ELFUTILS_HEADER(ebl)
@@ -33,7 +34,7 @@
int
main (int argc, char *argv[] __attribute__ ((unused)))
{
- const char *fname = "xxx";
+ const char *fname = "xxx_update3";
int fd;
Elf *elf;
Elf32_Ehdr *ehdr;
@@ -198,5 +199,7 @@ main (int argc, char *argv[] __attribute__ ((unused)))
exit (1);
}
+ unlink (fname);
+
return 0;
}
diff --git a/tests/update4.c b/tests/update4.c
index f5f91e3..85de6c3 100644
--- a/tests/update4.c
+++ b/tests/update4.c
@@ -34,7 +34,7 @@
int
main (int argc, char *argv[] __attribute__ ((unused)))
{
- const char fname[] = "xxx";
+ const char fname[] = "xxx_update4";
int fd;
Elf *elf;
Elf32_Ehdr *ehdr;
--
1.7.1