From 4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 27 Mar 2012 11:51:08 +0200 Subject: reorganize file structure to match the upstream requirements --- tests/intro/userprog-args/Make.tests | 27 +++++++++++ tests/intro/userprog-args/Rubric | 7 +++ tests/intro/userprog-args/args-dbl-space.ck | 1 + tests/intro/userprog-args/args-limit.c | 70 +++++++++++++++++++++++++++++ tests/intro/userprog-args/args-limit.ck | 11 +++++ tests/intro/userprog-args/args-many.ck | 1 + tests/intro/userprog-args/args-multiple.ck | 1 + tests/intro/userprog-args/args-none.ck | 1 + tests/intro/userprog-args/args-single.ck | 1 + tests/intro/userprog-args/args.c | 1 + tests/intro/userprog-args/child-simple.c | 1 + 11 files changed, 122 insertions(+) create mode 100644 tests/intro/userprog-args/Make.tests create mode 100644 tests/intro/userprog-args/Rubric create mode 120000 tests/intro/userprog-args/args-dbl-space.ck create mode 100644 tests/intro/userprog-args/args-limit.c create mode 100644 tests/intro/userprog-args/args-limit.ck create mode 120000 tests/intro/userprog-args/args-many.ck create mode 120000 tests/intro/userprog-args/args-multiple.ck create mode 120000 tests/intro/userprog-args/args-none.ck create mode 120000 tests/intro/userprog-args/args-single.ck create mode 120000 tests/intro/userprog-args/args.c create mode 120000 tests/intro/userprog-args/child-simple.c (limited to 'tests/intro/userprog-args') diff --git a/tests/intro/userprog-args/Make.tests b/tests/intro/userprog-args/Make.tests new file mode 100644 index 0000000..6f7a474 --- /dev/null +++ b/tests/intro/userprog-args/Make.tests @@ -0,0 +1,27 @@ +# -*- makefile -*- + +tests/intro/userprog-args/%.output: FILESYSSOURCE = --filesys-size=2 +tests/intro/userprog-args/%.output: PUTFILES = $(filter-out kernel.bin loader.bin, $^) +tests/intro/userprog-args/%.output: SIMULATOR = --qemu +tests/intro/userprog-args_TESTS = $(addprefix tests/intro/userprog-args/,args-none \ +args-single args-multiple args-many args-dbl-space args-limit) + +tests/intro/userprog-args_PROGS = $(tests/intro/userprog-args_TESTS) $(addprefix \ +tests/intro/userprog-args/,child-simple child-args) + +tests/intro/userprog-args/args-none_SRC = tests/intro/userprog-args/args.c +tests/intro/userprog-args/args-single_SRC = tests/intro/userprog-args/args.c +tests/intro/userprog-args/args-multiple_SRC = tests/intro/userprog-args/args.c +tests/intro/userprog-args/args-many_SRC = tests/intro/userprog-args/args.c +tests/intro/userprog-args/args-dbl-space_SRC = tests/intro/userprog-args/args.c +tests/intro/userprog-args/args-limit_SRC = tests/intro/userprog-args/args-limit.c + +tests/intro/userprog-args/child-simple_SRC = tests/intro/userprog-args/child-simple.c +tests/intro/userprog-args/child-args_SRC = tests/intro/userprog-args/args.c + +$(foreach prog,$(tests/intro/userprog-args_PROGS),$(eval $(prog)_SRC += tests/lib.c)) + +tests/intro/userprog-args/args-single_ARGS = onearg +tests/intro/userprog-args/args-multiple_ARGS = some arguments for you! +tests/intro/userprog-args/args-many_ARGS = a b c d e f g h i j k l m n o p q r s t u v +tests/intro/userprog-args/args-dbl-space_ARGS = two spaces! diff --git a/tests/intro/userprog-args/Rubric b/tests/intro/userprog-args/Rubric new file mode 100644 index 0000000..f5474c5 --- /dev/null +++ b/tests/intro/userprog-args/Rubric @@ -0,0 +1,7 @@ +Functionality of stack setup: +3 args-none +3 args-single +3 args-multiple +3 args-many +3 args-dbl-space +3 args-limit diff --git a/tests/intro/userprog-args/args-dbl-space.ck b/tests/intro/userprog-args/args-dbl-space.ck new file mode 120000 index 0000000..730d787 --- /dev/null +++ b/tests/intro/userprog-args/args-dbl-space.ck @@ -0,0 +1 @@ +../../userprog/args-dbl-space.ck \ No newline at end of file diff --git a/tests/intro/userprog-args/args-limit.c b/tests/intro/userprog-args/args-limit.c new file mode 100644 index 0000000..159d868 --- /dev/null +++ b/tests/intro/userprog-args/args-limit.c @@ -0,0 +1,70 @@ +/* Test the limit for (1) number of arguments and (2) total size of arguments */ +#include +#include +#include "tests/lib.h" + +#define MAX_SIZE 4096 + +static bool recurse (int, int); + +char cmd[MAX_SIZE * 4]; + +static bool +recurse (int argsize, int argcount) +{ + int i, j; + char *p; + strlcpy (cmd, "args-limit", 11); + p = cmd+strlen(cmd); + for (i = 0; i < argcount; i++) { + *p++ = ' '; + for (j = 0; j < argsize; j++) { + *p++ = 'X'; + } + } + *p = 0; + if (wait (exec (cmd)) < 0) { + return false; + } else { + return true; + } +} + +int +main (int argc, char **argv) +{ + test_name = argv[0]; + if(argc <= 1) { + int step; + int max_args = 0, max_size = 0; + + msg ("begin"); + + /* Binary search number of arguments */ + for (step = MAX_SIZE; step > 0 && max_args < MAX_SIZE; step>>=1) { + int t = max_args + step; + if (recurse (1, t)) { + max_args = t; + } + } + if (max_args > 63) { + msg ("success. at least 64 command line arguments are supported."); + } else { + msg ("FAIL: Only %d command line arguments are supported",max_args); + } + /* Binary search size of arguments */ + for (step = MAX_SIZE; step > 0 && max_size < MAX_SIZE; step>>=1) { + int t = max_size + step; + if (recurse (t, 1)) { + max_size = t; + } + } + if (max_size >= 100) { + msg ("success. arguments with at least 100 bytes are supported."); + } else { + msg ("FAIL: Arguments with more than %d bytes are not supported.",max_size); + } + msg ("end"); + } + return 0; +} diff --git a/tests/intro/userprog-args/args-limit.ck b/tests/intro/userprog-args/args-limit.ck new file mode 100644 index 0000000..ed8ead2 --- /dev/null +++ b/tests/intro/userprog-args/args-limit.ck @@ -0,0 +1,11 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); +(args-limit) begin +(args-limit) success. at least 64 command line arguments are supported. +(args-limit) success. arguments with at least 100 bytes are supported. +(args-limit) end +EOF +pass; diff --git a/tests/intro/userprog-args/args-many.ck b/tests/intro/userprog-args/args-many.ck new file mode 120000 index 0000000..ed175bd --- /dev/null +++ b/tests/intro/userprog-args/args-many.ck @@ -0,0 +1 @@ +../../userprog/args-many.ck \ No newline at end of file diff --git a/tests/intro/userprog-args/args-multiple.ck b/tests/intro/userprog-args/args-multiple.ck new file mode 120000 index 0000000..4f9935f --- /dev/null +++ b/tests/intro/userprog-args/args-multiple.ck @@ -0,0 +1 @@ +../../userprog/args-multiple.ck \ No newline at end of file diff --git a/tests/intro/userprog-args/args-none.ck b/tests/intro/userprog-args/args-none.ck new file mode 120000 index 0000000..861d319 --- /dev/null +++ b/tests/intro/userprog-args/args-none.ck @@ -0,0 +1 @@ +../../userprog/args-none.ck \ No newline at end of file diff --git a/tests/intro/userprog-args/args-single.ck b/tests/intro/userprog-args/args-single.ck new file mode 120000 index 0000000..df8e737 --- /dev/null +++ b/tests/intro/userprog-args/args-single.ck @@ -0,0 +1 @@ +../../userprog/args-single.ck \ No newline at end of file diff --git a/tests/intro/userprog-args/args.c b/tests/intro/userprog-args/args.c new file mode 120000 index 0000000..0d798ac --- /dev/null +++ b/tests/intro/userprog-args/args.c @@ -0,0 +1 @@ +../../userprog/args.c \ No newline at end of file diff --git a/tests/intro/userprog-args/child-simple.c b/tests/intro/userprog-args/child-simple.c new file mode 120000 index 0000000..f8a3ce7 --- /dev/null +++ b/tests/intro/userprog-args/child-simple.c @@ -0,0 +1 @@ +../../userprog/child-simple.c \ No newline at end of file -- cgit v1.2.3