mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Create unit test framework for subprocesses
This commit is contained in:
parent
263711965f
commit
c5659b93f8
10 changed files with 279 additions and 77 deletions
|
@ -29,30 +29,9 @@
|
|||
#include "libc/sysv/consts/ipproto.h"
|
||||
#include "libc/sysv/consts/sig.h"
|
||||
#include "libc/sysv/consts/sock.h"
|
||||
#include "libc/testlib/subprocess.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
#define SPAWN(METHOD) \
|
||||
{ \
|
||||
int ws, pid; \
|
||||
ASSERT_NE(-1, (pid = METHOD())); \
|
||||
if (!pid) {
|
||||
|
||||
#define EXITS(rc) \
|
||||
_Exit(0); \
|
||||
} \
|
||||
ASSERT_NE(-1, wait(&ws)); \
|
||||
ASSERT_TRUE(WIFEXITED(ws)); \
|
||||
ASSERT_EQ(rc, WEXITSTATUS(ws)); \
|
||||
}
|
||||
|
||||
#define TERMS(sig) \
|
||||
_Exit(0); \
|
||||
} \
|
||||
ASSERT_NE(-1, wait(&ws)); \
|
||||
ASSERT_TRUE(WIFSIGNALED(ws)); \
|
||||
ASSERT_EQ(sig, WTERMSIG(ws)); \
|
||||
}
|
||||
|
||||
void SetUp(void) {
|
||||
if (!__is_linux_2_6_23() && !IsOpenbsd()) exit(0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue