aboutsummaryrefslogtreecommitdiff
path: root/tests/init.test
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-05-11 21:48:28 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-05-14 18:08:06 +0300
commitcbd7cabcc3e6b24e80521bfec230e905f420ff4f (patch)
treef30aa2cd077fcb6a1939a7fdb79a80346d44d350 /tests/init.test
parent61cdde35094fc655eac2e6968b465f217e91d0ac (diff)
Add some tests
Diffstat (limited to 'tests/init.test')
-rw-r--r--tests/init.test95
1 files changed, 95 insertions, 0 deletions
diff --git a/tests/init.test b/tests/init.test
new file mode 100644
index 0000000..0200277
--- /dev/null
+++ b/tests/init.test
@@ -0,0 +1,95 @@
+# file : tests/init.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.test project.test
+
+new += 2>!
+status += --all
+
+test.cleanups += &prj/build/bootstrap/*** &?prj-cfg/***
+
+: cfg-create
+:
+: We will also test that the configuration variables are properly persisted and
+: the project is properly built in the source tree.
+:
+{
+ $clone_prj;
+
+ $* -C prj-cfg @cfg cc "config.cxx=$config.cxx" 'config.cc.poptions=-DTEST' 2>>/~"%EOE%";
+ initializing in project $~/prj/
+ created configuration @cfg $~/prj-cfg/ \(1, default, forwarded, auto-synchronized\)
+ synchronizing:
+ % new prj.0\.1\.0-a\.0\.19700101000000%
+ EOE
+
+ sed -n -e 's/^config.cc.poptions = (.+)$/\1/p' prj-cfg/build/config.build \
+ >'-DTEST';
+
+ $status --directory prj >'prj configured 0.1.0-a.0.19700101000000';
+
+ $build prj/ 2>>/EOE &prj/prj/prj$exe;
+ mkdir prj-cfg/prj/fsdir{prj/}
+ c++ prj/prj/cxx{prj}@prj-cfg/prj/prj/
+ ld prj-cfg/prj/prj/exe{prj}
+ ln prj-cfg/prj/prj/exe{prj} -> prj/prj/
+ EOE
+
+ $build prj-cfg/ 2>>/EOE
+ info: dir{prj-cfg/} is up to date
+ EOE
+}
+
+: cfg-add
+:
+{
+ create_cfg = $bpkg create cc "config.cxx=$config.cxx" -d 2>!
+
+ $clone_prj;
+
+ $create_cfg prj-cfg1/ &prj-cfg1/***;
+ $create_cfg prj-cfg2/ &prj-cfg2/***;
+
+ $* -A prj-cfg1 @cfg1 2>>/~"%EOE%";
+ initializing in project $~/prj/
+ added configuration @cfg1 $~/prj-cfg1/ \(1, default, forwarded, auto-synchronized\)
+ synchronizing:
+ % new prj.0\.1\.0-a\.0\.19700101000000%
+ EOE
+
+ $* -A prj-cfg2 @cfg2 2>>/~"%EOE%";
+ initializing in project $~/prj/
+ added configuration @cfg2 $~/prj-cfg2/ \(2, auto-synchronized\)
+ synchronizing:
+ % new prj.0\.1\.0-a\.0\.19700101000000%
+ EOE
+
+ $status --directory prj >>EOO;
+ in configuration @cfg1:
+ prj configured 0.1.0-a.0.19700101000000
+
+ in configuration @cfg2:
+ prj configured 0.1.0-a.0.19700101000000
+ EOO
+
+ $build prj-cfg1/ 2>>/EOE;
+ mkdir prj-cfg1/prj/fsdir{prj/}
+ c++ prj/prj/cxx{prj}@prj-cfg1/prj/prj/
+ ld prj-cfg1/prj/prj/exe{prj}
+ EOE
+
+ $build prj-cfg2/ 2>>/EOE;
+ mkdir prj-cfg2/prj/fsdir{prj/}
+ c++ prj/prj/cxx{prj}@prj-cfg2/prj/prj/
+ ld prj-cfg2/prj/prj/exe{prj}
+ EOE
+
+ $build prj/ 2>>/EOE &prj/prj/prj$exe
+ ln prj-cfg1/prj/prj/exe{prj} -> prj/prj/
+ info: prj-cfg1/dir{prj/} is up to date
+ EOE
+}
+
+# @@ Test initializing a package rather than project.
+#