summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-03-28 12:39:50 +0100
committerDavid Herrmann <dh.herrmann@gmail.com>2014-03-28 12:39:50 +0100
commitfc02c0aaf62f5accc3a074a8d431dd4ec8aa3e49 (patch)
treee14a2e3454e47a8a6f11e99f3e75ce779982e5cd
parent4f55a01dc319008e25c419c1878f69b17c47dd00 (diff)
test: make wpas tests safe to run in parallel
If you run "make check -jX", the test-suites will run in parallel. This currently works fine, but someone might copy the wpas tests into something more complex. In that case, the /tmp/XY files will be shared, which breaks the test-suite. Therefore, use pid-suffixes so these files are exclusive to the given test-process. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r--test/test_wpas.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/test/test_wpas.c b/test/test_wpas.c
index 215c667..9864f9d 100644
--- a/test/test_wpas.c
+++ b/test/test_wpas.c
@@ -25,9 +25,11 @@ static sd_event *event;
static struct wpas *start_test_client(void)
{
- const char *spath = "/tmp/miracle-test-sock";
+ char spath[128];
int r;
+ sprintf(spath, "/tmp/miracle-test-sock-%d", getpid());
+
r = sd_event_default(&event);
ck_assert_int_ge(r, 0);
@@ -54,10 +56,13 @@ static void stop_test_client(void)
START_TEST(bus_invalid_open)
{
- const char *ipath = "/tmp/miracle/invalid-test-dir/invalid-test-path";
+ char ipath[128];
struct wpas *w;
int r;
+ sprintf(ipath, "/tmp/miracle/invalid-test-dir/invalid-test-path-%d",
+ getpid());
+
/* test invalid client */
w = TEST_INVALID_PTR;
@@ -79,10 +84,13 @@ END_TEST
START_TEST(bus_invalid_create)
{
- const char *ipath = "/tmp/miracle/invalid-test-dir/invalid-test-path";
+ char ipath[128];
struct wpas *s;
int r;
+ sprintf(ipath, "/tmp/miracle/invalid-test-dir/invalid-test-path-%d",
+ getpid());
+
/* test invalid server */
s = TEST_INVALID_PTR;
@@ -100,10 +108,12 @@ END_TEST
START_TEST(bus_create)
{
- const char *spath = "/tmp/miracle-test-sock";
+ char spath[128];
struct wpas *w, *s;
int r;
+ sprintf(spath, "/tmp/miracle-test-sock-%d", getpid());
+
/* test server creation */
s = TEST_INVALID_PTR;
@@ -150,10 +160,12 @@ END_TEST
START_TEST(bus_open)
{
- const char *spath = "/tmp/miracle-test-sock";
+ char spath[128];
struct wpas *w, *s;
int r;
+ sprintf(spath, "/tmp/miracle-test-sock-%d", getpid());
+
/* test client connection */
s = TEST_INVALID_PTR;