diff --git a/bin/mktestsuite b/bin/mktestsuite index 31a5449d87d917bcc2f5b5409cd8ee44310454b8..bff7fb03f2dde2084707d39f33b04125f9ba700b 100755 --- a/bin/mktestsuite +++ b/bin/mktestsuite @@ -66,6 +66,12 @@ mixed a() { return [[$1]]; })]]) define(test_false, [[DOTEST(FALSE,dnl mixed a() { return [[$1]]; })]]) +define(test_compile,[[DOTEST(COMPILE,dnl +void x() { [[$1]] ; } )]]) + +define(test_compile_any,[[DOTEST(COMPILE,dnl +[[$1]] )]]) + define(test_compile_error,[[DOTEST(COMPILE_ERROR,dnl mixed a() { [[$1]]; })]]) diff --git a/bin/test_pike.pike b/bin/test_pike.pike index 847f6d7e91d9dcebc750573ab023437aedd928d9..fc2345a09f0c67ffd4f03d64bb316f7852cab25b 100755 --- a/bin/test_pike.pike +++ b/bin/test_pike.pike @@ -1,6 +1,6 @@ #!/usr/local/bin/pike -/* $Id: test_pike.pike,v 1.9 1998/04/08 22:05:36 hubbe Exp $ */ +/* $Id: test_pike.pike,v 1.10 1998/04/09 21:10:19 hubbe Exp $ */ #include <simulate.h> @@ -22,6 +22,10 @@ int main(int argc, string *argv) int loop=1; int end=0x7fffffff; + string *args=backtrace()[0][3]; + args=args[..sizeof(args)-1-argc]; + add_constant("RUNPIKE",args*" "); + foreach(Getopt.find_all_options(argv,aggregate( ({"help",Getopt.NO_ARG,({"-h","--help"})}), ({"verbose",Getopt.NO_ARG,({"-v","--verbose"})}), @@ -115,6 +119,17 @@ int main(int argc, string *argv) switch(type) { + case "COMPILE": + if(catch(compile_string(test,"Test "+(e+1)))) + { + werror("Test "+(e+1)+" failed.\n"); + werror(test+"\n"); + errors++; + }else{ + successes++; + } + break; + case "COMPILE_ERROR": master()->set_inhibit_compile_errors(1); if(catch(compile_string(test,"Test "+(e+1)))) diff --git a/lib/master.pike.in b/lib/master.pike.in index 35f385f253110fd75d02df189f1dc589bd46f628..db780e3dd75121e366124e892bb58336f509638a 100644 --- a/lib/master.pike.in +++ b/lib/master.pike.in @@ -1,4 +1,4 @@ -/* $Id: master.pike.in,v 1.3 1998/04/08 22:08:55 hubbe Exp $ +/* $Id: master.pike.in,v 1.4 1998/04/09 21:10:33 hubbe Exp $ * * Master-file for Pike. * @@ -478,8 +478,9 @@ mixed resolv(string identifier, string|void current_file) * and an array containing the environment variables on the same form as * a C program receives them. */ -void _main(string *argv, string *env) +void _main(string *orig_argv, string *env) { + string *argv=copy_value(orig_argv); int i,debug,trace; object script; object tmp; diff --git a/src/Makefile.in b/src/Makefile.in index 2c01af4c59ff718e21da72b31556039f879ad5c1..5aa337f8eee18186a5811d46a078d5046ca85b14 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,5 +1,5 @@ # -# $Id: Makefile.in,v 1.71 1998/04/09 03:07:00 hubbe Exp $ +# $Id: Makefile.in,v 1.72 1998/04/09 21:11:03 hubbe Exp $ # # This line is needed on some machines. @@ -447,6 +447,6 @@ stamp-h: $(SRCDIR)/machine.h.in config.status CONFIG_FILES="" CONFIG_HEADERS=machine.h ./config.status testsuite: $(SRCDIR)/testsuite.in - $(TMP_BINDIR)/mktestsuite $(SRCDIR)/testsuite.in >testsuite -DSRCDIR="$(SRCDIR)" -DRUNPIKE="$(RUNPIKE)" + $(TMP_BINDIR)/mktestsuite $(SRCDIR)/testsuite.in >testsuite -DSRCDIR="$(SRCDIR)" @dependencies@ diff --git a/src/modules/Makefile.in b/src/modules/Makefile.in index 8042aa8dbe156d541ecef78b8f27dad2e8a26226..8b2b8868f5f88f18ed1e6c95680d47981e1fae16 100644 --- a/src/modules/Makefile.in +++ b/src/modules/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.17 1998/04/08 08:13:51 hubbe Exp $ +# $Id: Makefile.in,v 1.18 1998/04/09 21:11:28 hubbe Exp $ @SET_MAKE@ @@ -49,7 +49,7 @@ verbose_verify: for a in $(MODULES) ; do ( cd $$a ; ${MAKE} $(MAKE_FLAGS) MODNAME=$$a verbose_verify ) || exit $$? ; done testsuites: - for a in $(MODULES) ; do $(TMP_BINDIR)/mktestsuite $(SRCDIR)/$$a/testsuite.in >$$a/module_testsuite -DSRCDIR=$(SRCDIR)/$$a -DRUNPIKE="$(RUNPIKE)" || exit $$? ; done + for a in $(MODULES) ; do $(TMP_BINDIR)/mktestsuite $(SRCDIR)/$$a/testsuite.in >$$a/module_testsuite -DSRCDIR=$(SRCDIR)/$$a || exit $$? ; done extra_tests: for a in $(MODULES) ; do ( cd $$a ; ${MAKE} $(MAKE_FLAGS) MODNAME=$$a extra_tests ) || exit $$? ; done diff --git a/src/testsuite.in b/src/testsuite.in index d6e268bed52ab94a78b22c00150e9acfb8559f15..87b152a1d9c4ddc195279d2e5c580c4583997355 100644 --- a/src/testsuite.in +++ b/src/testsuite.in @@ -1,4 +1,4 @@ -test_true([["$Id: testsuite.in,v 1.85 1998/04/08 08:13:21 hubbe Exp $"]]) +test_true([["$Id: testsuite.in,v 1.86 1998/04/09 21:11:03 hubbe Exp $"]]) test_eq(1e1,10.0) test_eq(1E1,10.0) test_eq(1e+1,10.0) @@ -12,7 +12,8 @@ test_eq([[#"foo bar"]],[["foo\nbar"]]) test_true([[stringp(#string "Makefile")]]) test_any([[object(Stdio.File) f; f=Stdio.File(); return 1]],1) -test_compile([[class { object(Stdio.FILE) f; void create() { f=Stdio.FILE(); }}]]) +test_compile([[int t=gauge { string foo; };]]) +test_compile_any([[class { object(Stdio.FILE) f; void create() { f=Stdio.FILE(); }}]]) test_eq([[compile_string("#define A(X) (X)\nint x() { return A \n\t(1); }")()->x()]],1) test_any([[class G { mapping t=([]); class tO { void init(string name) { t[name]=this_object(); }} @@ -27,7 +28,26 @@ test_program([[class foo { program x() { return class {}; }}; class bar { inheri // Testing the 'inline' keyword test_program([[class foo { inline int c() { return time(); } int d() { return c(); } }; class bar { inherit foo; int c() { return 0; } } int a() { return bar()->d(); }]],0) -test_compile([[class inherit_top { inherit top:top; constant top_the_class=top::the_class; class the_other_class { inherit top_the_class; } } ]]) +test_compile_any([[ + class top + { + class the_class + { + } + } + + class inherit_top + { + inherit top:top; + + constant top_the_class=top::the_class; + + class the_other_class + { + inherit top_the_class; + } + } +]]) test_any([[ class X { static string f() { return "p"; } @@ -130,7 +150,7 @@ test_true(clone(class c { constant i=0; mixed `[](string s) { if(s=="i") return test_true(clone(class c { mixed `[]=(mixed a, mixed b) { if(a!=b) throw(1); }})[1]=1) test_true(clone(class c { mixed `->=(mixed a, mixed b) { if(a!=b) throw(1); }})->i="i") -test_compile(class A {}; class B { inherit A; }) +test_compile_any(class A {}; class B { inherit A; }) test_true(mappingp(_memory_usage())) test_true(objectp( _next(this_object()) || _prev(this_object()))) @@ -1604,6 +1624,7 @@ test_eq([[combine_path("./","..")]],"..") test_eq([[combine_path("./.","..")]],"..") test_eq([[combine_path("/","../../foo")]],"/foo") test_eq([[combine_path("./foobar/.","..")]],".") +test_eq([[combine_path("/","foo","bar","gazonk")]],"/foo/bar/gazonk") // - compile_file // FIXME: add tests for compile_file @@ -1929,6 +1950,6 @@ test_true(Process.popen) test_true(Process.spawn) test_true(Process.system) test_true(Process.create_process) -test_false([[Process.system("]]RUNPIKE[[ -e 'exit(0)'")]]) -test_true([[Process.system("]]RUNPIKE[[ -e 'exit(1)'")]]) -test_eq([[Process.popen("]]RUNPIKE[[ -e 'write(\"test\");'")]],"test") +test_false([[Process.system(RUNPIKE +" -e 'exit(0)'")]]) +test_true([[Process.system(RUNPIKE+" -e 'exit(1)'")]]) +test_eq([[Process.popen(RUNPIKE+" -e 'write(\"test\");'")]],"test")