Browse Source

Add a regression test for notify.

This just does a deref through 0 and passes if we catch
the note.

Change-Id: Ie8331e5a17f523997e9ed09a645a0c14c690c346
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Ronald G. Minnich 8 years ago
parent
commit
72f5f4fa6f
2 changed files with 25 additions and 0 deletions
  1. 24 0
      sys/src/regress/notify.c
  2. 1 0
      sys/src/regress/regress.json

+ 24 - 0
sys/src/regress/notify.c

@@ -0,0 +1,24 @@
+#include <u.h>
+#include <libc.h>
+#define RET 0xc3
+
+void
+handler(void *v, char *s)
+{
+	print("PASS\n");
+	exits("PASS");
+}
+
+void
+main(void)
+{
+	void (*f)(void) = nil;
+	if (notify(handler)){
+		fprint(2, "%r\n");
+		exits("notify fails");
+	}
+
+	f();
+	print("FAIL");
+	exits("FAIL");
+}

+ 1 - 0
sys/src/regress/regress.json

@@ -16,6 +16,7 @@
 		"mixedfloat.c",
 		"mmap.c",
 		"nanotime.c",
+		"notify.c",
 		"nx.c",
 		"privates.c",
 		"psx.c",