aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-02-05 14:39:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-02-05 14:39:47 +0200
commit36ec90018e1a6337d23fc5286ed926c2134bde1f (patch)
tree40710bf9555076689d1ee7726ec3e29317dba00a
parent3954be70024fd60c20c658f08025eff7654a8943 (diff)
Add tests for auto-generated test inputs/outputs
-rw-r--r--old-tests/test/generated/build/bootstrap.build8
-rw-r--r--old-tests/test/generated/buildfile10
-rw-r--r--old-tests/test/generated/test.out1
-rw-r--r--old-tests/test/generated/utility.cxx1
-rw-r--r--old-tests/test/simple/build/bootstrap.build4
-rw-r--r--old-tests/test/simple/buildfile12
-rw-r--r--old-tests/test/simple/driver.cxx14
-rw-r--r--old-tests/test/simple/test.out1
-rw-r--r--old-tests/test/simple/utility.cxx1
-rw-r--r--tests/test/script/generated/buildfile8
-rw-r--r--tests/test/script/generated/driver.cxx11
-rw-r--r--tests/test/script/generated/testscript34
-rw-r--r--tests/test/script/generated/testscript.in5
-rw-r--r--tests/test/script/integration/buildfile (renamed from tests/test/script-integration/buildfile)2
-rw-r--r--tests/test/script/integration/testscript (renamed from tests/test/script-integration/testscript)6
-rw-r--r--tests/test/simple/generated/buildfile8
-rw-r--r--tests/test/simple/generated/driver.cxx11
-rw-r--r--tests/test/simple/generated/output.in1
-rw-r--r--tests/test/simple/generated/testscript42
-rw-r--r--tests/test/simple/generated/utility.cxx (renamed from old-tests/test/generated/driver.cxx)6
20 files changed, 129 insertions, 57 deletions
diff --git a/old-tests/test/generated/build/bootstrap.build b/old-tests/test/generated/build/bootstrap.build
deleted file mode 100644
index 1b04c1d..0000000
--- a/old-tests/test/generated/build/bootstrap.build
+++ /dev/null
@@ -1,8 +0,0 @@
-project = generated
-amalgamation = # Disabled.
-
-dist.package = $project
-
-using config
-using test
-using dist
diff --git a/old-tests/test/generated/buildfile b/old-tests/test/generated/buildfile
deleted file mode 100644
index d3fbc20..0000000
--- a/old-tests/test/generated/buildfile
+++ /dev/null
@@ -1,10 +0,0 @@
-# Test generated input.
-#
-using cxx
-
-exe{utility}: cxx{utility}
-exe{driver}: cxx{driver}
-exe{driver}: test.input = exe{utility} # Update test.
-exe{driver}: test.output = file{test.out} # Dist test.
-
-./: exe{driver}
diff --git a/old-tests/test/generated/test.out b/old-tests/test/generated/test.out
deleted file mode 100644
index 53752db..0000000
--- a/old-tests/test/generated/test.out
+++ /dev/null
@@ -1 +0,0 @@
-output
diff --git a/old-tests/test/generated/utility.cxx b/old-tests/test/generated/utility.cxx
deleted file mode 100644
index ca2ac4a..0000000
--- a/old-tests/test/generated/utility.cxx
+++ /dev/null
@@ -1 +0,0 @@
-int main () {}
diff --git a/old-tests/test/simple/build/bootstrap.build b/old-tests/test/simple/build/bootstrap.build
deleted file mode 100644
index 0b7a347..0000000
--- a/old-tests/test/simple/build/bootstrap.build
+++ /dev/null
@@ -1,4 +0,0 @@
-project = test-simple
-amalgamation = # Disabled.
-using config
-using test
diff --git a/old-tests/test/simple/buildfile b/old-tests/test/simple/buildfile
deleted file mode 100644
index 569c12c..0000000
--- a/old-tests/test/simple/buildfile
+++ /dev/null
@@ -1,12 +0,0 @@
-using cxx
-
-lib{utility}: cxx{utility}
-exe{driver}: cxx{driver} #lib{utility}
-
-#exe{driver}: test.roundtrip = test.out
-
-exe{*}: test = true
-exe{*}: test.output = test.out
-
-./: lib{utility} exe{driver}
-#./: exe{driver}
diff --git a/old-tests/test/simple/driver.cxx b/old-tests/test/simple/driver.cxx
deleted file mode 100644
index 3753821..0000000
--- a/old-tests/test/simple/driver.cxx
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <iostream>
-#include <cassert>
-
-using namespace std;
-
-int
-main ()
-{
- cerr << "test is running (stderr)" << endl;
- //assert (false);
- cout << "test is running (stdout)" << endl;
- return 0;
- //return 1;
-}
diff --git a/old-tests/test/simple/test.out b/old-tests/test/simple/test.out
deleted file mode 100644
index 5d63fab..0000000
--- a/old-tests/test/simple/test.out
+++ /dev/null
@@ -1 +0,0 @@
-test is running (stdout)
diff --git a/old-tests/test/simple/utility.cxx b/old-tests/test/simple/utility.cxx
deleted file mode 100644
index c4bb446..0000000
--- a/old-tests/test/simple/utility.cxx
+++ /dev/null
@@ -1 +0,0 @@
-void f (){}
diff --git a/tests/test/script/generated/buildfile b/tests/test/script/generated/buildfile
new file mode 100644
index 0000000..c27b49d
--- /dev/null
+++ b/tests/test/script/generated/buildfile
@@ -0,0 +1,8 @@
+# file : tests/test/script/generated/buildfile
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+# Test generated testscripts.
+#
+
+./: test{testscript} $b file{*.cxx +*.in}
diff --git a/tests/test/script/generated/driver.cxx b/tests/test/script/generated/driver.cxx
new file mode 100644
index 0000000..e155462
--- /dev/null
+++ b/tests/test/script/generated/driver.cxx
@@ -0,0 +1,11 @@
+// file : tests/test/script/generated/driver.cxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#include <iostream>
+
+int
+main ()
+{
+ std::cout << "1.2.3" << std::endl;
+}
diff --git a/tests/test/script/generated/testscript b/tests/test/script/generated/testscript
new file mode 100644
index 0000000..572c73f
--- /dev/null
+++ b/tests/test/script/generated/testscript
@@ -0,0 +1,34 @@
+# file : tests/test/script/generated/testscript
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+test.arguments = test clean
+
+# Note: using common.test from test/, not script/.
+#
+.include ../../common.test
+
+# @@ in module
+#
++cat <<EOI >+build/bootstrap.build
+using version
+EOI
++cat <<EOI >=manifest
+: 1
+name: test
+version: 1.2.3
+EOI
+
++cat <<EOI >=build/root.build
+using cxx
+EOI
+
+: testscript
+:
+ln -s $src_base/driver.cxx ./;
+ln -s $src_base/testscript.in ./;
+$* <<EOI
+exe{driver}: cxx{driver} test{testscript}
+test{testscript}: in{testscript} $src_root/file{manifest} #@@ in module
+test{testscript}: in.symbol = '@'
+EOI
diff --git a/tests/test/script/generated/testscript.in b/tests/test/script/generated/testscript.in
new file mode 100644
index 0000000..b030b39
--- /dev/null
+++ b/tests/test/script/generated/testscript.in
@@ -0,0 +1,5 @@
+# file : tests/test/script/generated/testscript.in
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+$* >'@version@'
diff --git a/tests/test/script-integration/buildfile b/tests/test/script/integration/buildfile
index 4249e1f..1cc1e30 100644
--- a/tests/test/script-integration/buildfile
+++ b/tests/test/script/integration/buildfile
@@ -1,4 +1,4 @@
-# file : tests/test/script-integration/buildfile
+# file : tests/test/script/integration/buildfile
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
diff --git a/tests/test/script-integration/testscript b/tests/test/script/integration/testscript
index faade22..7074e36 100644
--- a/tests/test/script-integration/testscript
+++ b/tests/test/script/integration/testscript
@@ -1,8 +1,10 @@
-# file : tests/test/script-integration/testscript
+# file : tests/test/script/integration/testscript
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-.include ../common.test
+# Note: using common.test from test/, not script/.
+#
+.include ../../common.test
: script-files
:
diff --git a/tests/test/simple/generated/buildfile b/tests/test/simple/generated/buildfile
new file mode 100644
index 0000000..af97abd
--- /dev/null
+++ b/tests/test/simple/generated/buildfile
@@ -0,0 +1,8 @@
+# file : tests/test/simple/generated/buildfile
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+# Test generated test inputs/outputs.
+#
+
+./: test{testscript} $b file{*.cxx +*.in}
diff --git a/tests/test/simple/generated/driver.cxx b/tests/test/simple/generated/driver.cxx
new file mode 100644
index 0000000..fb3ab8f
--- /dev/null
+++ b/tests/test/simple/generated/driver.cxx
@@ -0,0 +1,11 @@
+// file : tests/test/simple/generated/driver.cxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#include <iostream>
+
+int
+main ()
+{
+ std::cout << "1.2.3" << std::endl;
+}
diff --git a/tests/test/simple/generated/output.in b/tests/test/simple/generated/output.in
new file mode 100644
index 0000000..36d79d4
--- /dev/null
+++ b/tests/test/simple/generated/output.in
@@ -0,0 +1 @@
+$version$
diff --git a/tests/test/simple/generated/testscript b/tests/test/simple/generated/testscript
new file mode 100644
index 0000000..9ec5220
--- /dev/null
+++ b/tests/test/simple/generated/testscript
@@ -0,0 +1,42 @@
+# file : tests/test/simple/generated/testscript
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+test.arguments = test clean
+
+.include ../../common.test
+
+# @@ in module
+#
++cat <<EOI >+build/bootstrap.build
+using version
+EOI
++cat <<EOI >=manifest
+: 1
+name: test
+version: 1.2.3
+EOI
+
++cat <<EOI >=build/root.build
+using cxx
+EOI
+
+: input
+:
+ln -s $src_base/driver.cxx ./;
+ln -s $src_base/utility.cxx ./;
+$* <<EOI
+exe{utility}: cxx{utility}
+exe{utility}: exe{driver}: test.input = true
+exe{driver}: cxx{driver}
+EOI
+
+: output
+:
+ln -s $src_base/driver.cxx ./;
+ln -s $src_base/output.in ./;
+$* <<EOI
+exe{driver}: cxx{driver}
+exe{driver}: file{output}: test.stdout = true
+file{output}: in{output} $src_root/file{manifest} #@@ in module
+EOI
diff --git a/old-tests/test/generated/driver.cxx b/tests/test/simple/generated/utility.cxx
index f674141..e2113bd 100644
--- a/old-tests/test/generated/driver.cxx
+++ b/tests/test/simple/generated/utility.cxx
@@ -1,3 +1,7 @@
+// file : tests/test/simple/generated/utility.cxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
#include <iostream>
#include <fstream>
@@ -20,7 +24,5 @@ main (int argc, char* argv[])
if (ifs.tellg () == 0)
cerr << argv[1] << " is empty" << endl;
- cout << "output" << endl;
-
return 0;
}