From Godmar Back.
tests/vm_TESTS = $(addprefix tests/vm/,pt-grow-stack pt-grow-pusha \
pt-grow-bad pt-big-stk-obj pt-bad-addr pt-bad-read pt-write-code \
-pt-write-code2 page-linear page-parallel page-merge-seq page-merge-par \
-page-shuffle mmap-read mmap-close mmap-unmap mmap-overlap mmap-twice \
-mmap-write mmap-exit mmap-shuffle mmap-bad-fd mmap-clean mmap-inherit \
-mmap-misalign mmap-null mmap-over-code mmap-over-data mmap-over-stk \
-mmap-remove mmap-zero)
+pt-write-code2 pt-grow-stk-sc page-linear page-parallel page-merge-seq \
+page-merge-par page-shuffle mmap-read mmap-close mmap-unmap \
+mmap-overlap mmap-twice mmap-write mmap-exit mmap-shuffle mmap-bad-fd \
+mmap-clean mmap-inherit mmap-misalign mmap-null mmap-over-code \
+mmap-over-data mmap-over-stk mmap-remove mmap-zero)
tests/vm_PROGS = $(tests/vm_TESTS) $(addprefix tests/vm/,child-linear \
child-sort child-mm-wrt child-inherit)
tests/vm/pt-bad-read_SRC = tests/vm/pt-bad-read.c tests/lib.c tests/main.c
tests/vm/pt-write-code_SRC = tests/vm/pt-write-code.c tests/lib.c tests/main.c
tests/vm/pt-write-code2_SRC = tests/vm/pt-write-code-2.c tests/lib.c tests/main.c
+tests/vm/pt-grow-stk-sc_SRC = tests/vm/pt-grow-stk-sc.c tests/lib.c tests/main.c
tests/vm/page-linear_SRC = tests/vm/page-linear.c tests/arc4.c \
tests/lib.c tests/main.c
tests/vm/page-parallel_SRC = tests/vm/page-parallel.c tests/lib.c tests/main.c
Functionality of virtual memory subsystem:
- Test page table.
-6 pt-grow-stack
+4 pt-grow-stack
+2 pt-grow-stk-sc
6 pt-big-stk-obj
6 pt-grow-pusha
--- /dev/null
+/* This test checks that the stack is properly extended even if
+ the first access to a stack location occurs inside a system
+ call.
+
+ From Godmar Back. */
+
+#include <string.h>
+#include <syscall.h>
+#include "tests/vm/sample.inc"
+#include "tests/lib.h"
+#include "tests/main.h"
+
+void
+test_main (void)
+{
+ int handle;
+ int slen = strlen (sample);
+ char buf2[65536];
+
+ /* Write file via write(). */
+ CHECK (create ("sample.txt", slen), "create \"sample.txt\"");
+ CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\"");
+ CHECK (write (handle, sample, slen) == slen, "write \"sample.txt\"");
+ close (handle);
+
+ /* Read back via read(). */
+ CHECK ((handle = open ("sample.txt")) > 1, "2nd open \"sample.txt\"");
+ CHECK (read (handle, buf2 + 32768, slen) == slen, "read \"sample.txt\"");
+
+ CHECK (!memcmp (sample, buf2 + 32768, slen), "compare written data against read data");
+ close (handle);
+}
--- /dev/null
+# -*- perl -*-
+use strict;
+use warnings;
+use tests::tests;
+check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']);
+(pt-grow-stk-sc) begin
+(pt-grow-stk-sc) create "sample.txt"
+(pt-grow-stk-sc) open "sample.txt"
+(pt-grow-stk-sc) write "sample.txt"
+(pt-grow-stk-sc) 2nd open "sample.txt"
+(pt-grow-stk-sc) read "sample.txt"
+(pt-grow-stk-sc) compare written data against read data
+(pt-grow-stk-sc) end
+EOF