summaryrefslogtreecommitdiff
path: root/build2/test
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-09-20 19:44:29 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-09-20 19:44:29 +0300
commitbc03157da5a9c6fe4af803eaad24f717c3077390 (patch)
tree9020090f2d38e734fb82924672908ed94fcf68a5 /build2/test
parenta6183309398e2369bd897841da0887435b029d60 (diff)
Update feature: Test description language (testscript)
Diffstat (limited to 'build2/test')
-rw-r--r--build2/test/testscript66
1 files changed, 66 insertions, 0 deletions
diff --git a/build2/test/testscript b/build2/test/testscript
index 530c317..e467b3b 100644
--- a/build2/test/testscript
+++ b/build2/test/testscript
@@ -26,6 +26,8 @@ Requirements
* Ability to pass arguments from build files (how for multiple scripts?)
Could use $0, $1, $*.
+* Ability to pass arguments from command line.
+
? if/else, loops (we will have ternary operator as part of eval context)
* Multi-line comments (to disable a chunk of test; #\)
@@ -56,6 +58,11 @@ Questions
* Ability to redefine $0 (e.g., to src_base to run scripts)?
+* What extension to use for script files? Should it be conventional or
+ configurable/enforced?
+
+ .t, .test, .ts, .tst, .bt, <none>
+
Notes
=====
@@ -118,6 +125,9 @@ EOE
the test create a file without a redirect? Will need to "register" it
somehow for auto-cleanup. Maybe &<file>? Also for directories &<dir>/.
+ Does this mean that any program argument starting with & is recognized to
+ be a file/directory for auto-cleanup?
+
~ Will there be a way to combine stderr and stdout, could be useful sometimes
(e.g., order of output relative to diagnostics). 2>& syntax?
@@ -195,3 +205,59 @@ EOE
v=`a x b | c y f`
But would be nice to see a real use-case that needed this.
+
+~ How to control script execution from the command line? What about the
+ followig approach.
+
+ For test operation build2 assumes arguments which follows a special marker
+ (-) to be intended for a test script target and get assigned to a special
+ variable ($@). Test script normally just pass them to the program being
+ tested. In the absense of the marker all unrecognized arguments are assigned
+ to $@. So effectivelly the marker is required only to disambiguate build2 own
+ arguments from a test target ones. Test script do not extract any information
+ from $@ (while can modify it as any other variable).
+
+ To ammend a test script execution the command line variables can be used.
+ Probably it make sense to require such a variable to be defined in a
+ buildfile to make sure it is initialized (with a default value). Example:
+
+ buildfile:
+
+ ./: test = test1
+ ./: test.test1.c = ""
+ ./: test.test1.remote = false
+ ./: test.test1.verbose = false
+
+ test1 script:
+
+ $@ = (verbose ? : "-q") + $@
+ cxx_options = (c != "" ? "config.cxx=$c" : )
+
+ Command line:
+
+ $ b test remote=true c=clang++ verbose=true - --verbose 4
+
+ To define variable for all target test script we could use a special script
+ name (*):
+
+ ./: test = test1 test2
+ ./: test.*.c = ""
+
+ It is also tempting to extract test script variable values from command line
+ options, so the above example could be changed in the following way:
+
+ buildfile:
+
+ ./: test = test1
+ ./: test.test1.c = ""
+ ./: test.test1.remote = false
+ ./: test.test1.verbose = 0
+
+ test1 script:
+
+ $@ = (verbose == 0 ? "-q" : ) + $@
+ cxx_options = (c != "" ? "config.cxx=$c" : )
+
+ Command line:
+
+ $ b test remote=true c=clang++ - --verbose 4