aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-06-02 04:20:21 +0200
committerMattias Andrée <maandree@kth.se>2020-06-02 04:20:21 +0200
commitf84d2aebd4d295f08c50b88ed4452f6c9b6605e6 (patch)
treea6a731ac9a99f67021364091426cd58a6c7b0886 /tests
parentFix exit status regression ... now I can go back to sleep again (diff)
downloadsctrace-f84d2aebd4d295f08c50b88ed4452f6c9b6605e6.tar.gz
sctrace-f84d2aebd4d295f08c50b88ed4452f6c9b6605e6.tar.bz2
sctrace-f84d2aebd4d295f08c50b88ed4452f6c9b6605e6.tar.xz
Reject i386 and x32 applications (not yet supported)
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore3
-rw-r--r--tests/Makefile54
-rw-r--r--tests/fork.c4
-rw-r--r--tests/signal.c4
4 files changed, 38 insertions, 27 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index a8d6b6c..d961f3e 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1 +1,2 @@
-*.t
+*.32
+*.64
diff --git a/tests/Makefile b/tests/Makefile
index db5caa7..6e0d8da 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,32 +1,38 @@
.POSIX:
-BIN =\
- abort.t\
- cont.t\
- exec.t\
- exit.t\
- fork.t\
- fork-stop.t\
- kill.t\
- raise.t\
- siginfo.t\
- signal.t\
- stop.t\
- threads.t\
- tstp.t\
- vfork.t\
- vfork-exec.t
-
-all: $(BIN)
-$(BIN): $(@:.t=.c)
-
-.c.t:
- $(CC) -static -pthread -Og -g -o $@ $< -D_XOPEN_SOURCE=700
+BIN_64 =\
+ abort.64\
+ cont.64\
+ exec.64\
+ exit.64\
+ fork.64\
+ fork-stop.64\
+ kill.64\
+ raise.64\
+ siginfo.64\
+ signal.64\
+ stop.64\
+ threads.64\
+ tstp.64\
+ vfork.64\
+ vfork-exec.64
+
+BIN_32 = $(BIN_64:.64=.32)
+
+all: $(BIN_64) $(BIN_32)
+$(BIN_64): $(@:.64=.c)
+$(BIN_32): $(@:.32=.c)
+
+.c.64:
+ $(CC) -static -pthread -Og -g -o $@ $< -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE
+
+.c.32:
+ $(CC) -m32 -static -pthread -Og -g -o $@ $< -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE
clean:
- -rm -f -- $(BIN)
+ -rm -f -- $(BIN_64) $(BIN_32)
.SUFFIXES:
-.SUFFIXES: .t .c
+.SUFFIXES: .32 .64 .c
.PHONY: all clean
diff --git a/tests/fork.c b/tests/fork.c
index 7bbc4c2..993e0d4 100644
--- a/tests/fork.c
+++ b/tests/fork.c
@@ -1,15 +1,17 @@
+#include <time.h>
#include <unistd.h>
int
main(void)
{
+ struct timespec ts = {0, 100000000L};
switch (fork()) {
case -1:
return -1;
case 0:
return 2;
default:
- usleep(100000U);
+ nanosleep(&ts, NULL);
return 1;
}
}
diff --git a/tests/signal.c b/tests/signal.c
index e4862cd..a68edcd 100644
--- a/tests/signal.c
+++ b/tests/signal.c
@@ -1,4 +1,5 @@
#include <signal.h>
+#include <time.h>
#include <unistd.h>
static void
@@ -10,9 +11,10 @@ interrupt()
int
main(void)
{
+ struct timespec ts = {0, 100000000L};
signal(SIGINT, interrupt);
kill(getpid(), SIGINT);
- usleep(100000U);
+ nanosleep(&ts, NULL);
write(-1, "qwerty\n", 7);
return 0;
}