mirror of
https://github.com/albfan/miraclecast.git
synced 2025-03-09 23:38:56 +00:00
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>
This commit is contained in:
parent
4f55a01dc3
commit
fc02c0aaf6
1 changed files with 17 additions and 5 deletions
|
@ -25,9 +25,11 @@ static sd_event *event;
|
||||||
|
|
||||||
static struct wpas *start_test_client(void)
|
static struct wpas *start_test_client(void)
|
||||||
{
|
{
|
||||||
const char *spath = "/tmp/miracle-test-sock";
|
char spath[128];
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
sprintf(spath, "/tmp/miracle-test-sock-%d", getpid());
|
||||||
|
|
||||||
r = sd_event_default(&event);
|
r = sd_event_default(&event);
|
||||||
ck_assert_int_ge(r, 0);
|
ck_assert_int_ge(r, 0);
|
||||||
|
|
||||||
|
@ -54,10 +56,13 @@ static void stop_test_client(void)
|
||||||
|
|
||||||
START_TEST(bus_invalid_open)
|
START_TEST(bus_invalid_open)
|
||||||
{
|
{
|
||||||
const char *ipath = "/tmp/miracle/invalid-test-dir/invalid-test-path";
|
char ipath[128];
|
||||||
struct wpas *w;
|
struct wpas *w;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
sprintf(ipath, "/tmp/miracle/invalid-test-dir/invalid-test-path-%d",
|
||||||
|
getpid());
|
||||||
|
|
||||||
/* test invalid client */
|
/* test invalid client */
|
||||||
|
|
||||||
w = TEST_INVALID_PTR;
|
w = TEST_INVALID_PTR;
|
||||||
|
@ -79,10 +84,13 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(bus_invalid_create)
|
START_TEST(bus_invalid_create)
|
||||||
{
|
{
|
||||||
const char *ipath = "/tmp/miracle/invalid-test-dir/invalid-test-path";
|
char ipath[128];
|
||||||
struct wpas *s;
|
struct wpas *s;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
sprintf(ipath, "/tmp/miracle/invalid-test-dir/invalid-test-path-%d",
|
||||||
|
getpid());
|
||||||
|
|
||||||
/* test invalid server */
|
/* test invalid server */
|
||||||
|
|
||||||
s = TEST_INVALID_PTR;
|
s = TEST_INVALID_PTR;
|
||||||
|
@ -100,10 +108,12 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(bus_create)
|
START_TEST(bus_create)
|
||||||
{
|
{
|
||||||
const char *spath = "/tmp/miracle-test-sock";
|
char spath[128];
|
||||||
struct wpas *w, *s;
|
struct wpas *w, *s;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
sprintf(spath, "/tmp/miracle-test-sock-%d", getpid());
|
||||||
|
|
||||||
/* test server creation */
|
/* test server creation */
|
||||||
|
|
||||||
s = TEST_INVALID_PTR;
|
s = TEST_INVALID_PTR;
|
||||||
|
@ -150,10 +160,12 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(bus_open)
|
START_TEST(bus_open)
|
||||||
{
|
{
|
||||||
const char *spath = "/tmp/miracle-test-sock";
|
char spath[128];
|
||||||
struct wpas *w, *s;
|
struct wpas *w, *s;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
sprintf(spath, "/tmp/miracle-test-sock-%d", getpid());
|
||||||
|
|
||||||
/* test client connection */
|
/* test client connection */
|
||||||
|
|
||||||
s = TEST_INVALID_PTR;
|
s = TEST_INVALID_PTR;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue