aboutsummaryrefslogtreecommitdiff
path: root/tests/sync.testscript
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-09-04 14:32:11 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-09-04 14:49:21 +0300
commitd1d9fbc899be37bba7b05f31ac5c7a4d15d64811 (patch)
tree99722bfda82125c5ad383917df0af794ff1b9e1f /tests/sync.testscript
parent971b29ac8c45da1659a57421f95d4caa237ee6be (diff)
Rename .test/test{} to .testscript/testscript{}
Diffstat (limited to 'tests/sync.testscript')
-rw-r--r--tests/sync.testscript204
1 files changed, 204 insertions, 0 deletions
diff --git a/tests/sync.testscript b/tests/sync.testscript
new file mode 100644
index 0000000..d01550b
--- /dev/null
+++ b/tests/sync.testscript
@@ -0,0 +1,204 @@
+# file : tests/sync.testscript
+# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.testscript
+
+cxx = cc config.cxx="$recall($cxx.path)"
+
+new += 2>!
+init += $cxx -d prj 2>!
+status += --all --recursive -d prj
+deinit += -d prj
+
+: single-pkg-cfg
+:
+{
+ $new -C @cfg prj $cxx &prj/*** &prj-cfg/***;
+
+ $new -t lib libprj &libprj/***;
+
+ cat <<EOI >+prj/repositories.manifest;
+ :
+ role: prerequisite
+ location: ../libprj
+ type: dir
+ EOI
+
+ cat <<EOI >+prj/manifest;
+ depends: libprj
+ EOI
+
+ sed -i -e 's/^(#import .+)$/import libs += libprj%lib{prj}/' \
+ prj/prj/buildfile;
+
+ cat <<EOI >=prj/prj/prj.cxx;
+ #include <iostream>
+
+ #include <libprj/prj.hxx>
+
+ using namespace std;
+
+ int main (int argc, char* argv[])
+ {
+ if (argc < 2)
+ {
+ cerr << "error: missing name" << endl;
+ return 1;
+ }
+
+ prj::say_hello (cout, argv[1]);
+ }
+ EOI
+
+ $* -d prj 2>>/~"%EOE%";
+ fetching dir:$~/libprj \(prerequisite of dir:$~/prj\)
+ synchronizing:
+ % new libprj.+ \\\(required by prj\\\)%
+ % upgrade prj.+19700101000000#1%
+ EOE
+
+ $status >>~%EOO%;
+ prj configured 0.1.0-a.0.19700101000000#1
+ % libprj configured 0.+%
+ EOO
+
+ $build prj/ 2>>~%EOE%;
+ %(mkdir|version\.in|c\+\+|ld|ln) .+%{8}
+ EOE
+
+ $build 'clean:' prj/ 2>>~%EOE%;
+ %rm .+%{3}
+ EOE
+
+ $deinit 2>>/"EOE"
+ deinitializing in project $~/prj/
+ synchronizing:
+ drop prj
+ drop libprj
+ EOE
+}
+
+: multi-pkg-cfg
+:
+{
+ $new -t empty prj &prj/***;
+
+ $new --package pkg1 -d prj;
+ $new --package pkg2 -d prj;
+
+ $init -C @cfg1 &prj-cfg1/***;
+ $init -C @cfg2 &prj-cfg2/***;
+
+ $new -t lib libprj &libprj/***;
+
+ cat <<EOI >+prj/repositories.manifest;
+ :
+ role: prerequisite
+ location: ../libprj
+ type: dir
+ EOI
+
+ cat <<EOI >+prj/pkg1/manifest;
+ depends: libprj
+ EOI
+
+ sed -i -e 's/^(#import .+)$/import libs += libprj%lib{prj}/' \
+ prj/pkg1/pkg1/buildfile;
+
+ cat <<EOI >=prj/pkg1/pkg1/pkg1.cxx;
+ #include <iostream>
+
+ #include <libprj/prj.hxx>
+
+ using namespace std;
+
+ int main (int argc, char* argv[])
+ {
+ if (argc < 2)
+ {
+ cerr << "error: missing name" << endl;
+ return 1;
+ }
+
+ prj::say_hello (cout, argv[1]);
+ }
+ EOI
+
+ cat <<EOI >+prj/pkg2/manifest;
+ tags: c++
+ EOI
+
+ # Sync the default (cfg1) configuration (via the package directory).
+ #
+ $* -d prj/pkg2 2>>/~"%EOE%";
+ fetching dir:$~/libprj \(prerequisite of dir:$~/prj\)
+ synchronizing:
+ % new libprj.+ \\\(required by pkg1\\\)%
+ % upgrade pkg1.+19700101000000#1%
+ % upgrade pkg2.+19700101000000#1%
+ EOE
+
+ $status >>~%EOO% 2>>/~"%EOE%"; # Note: implicitly fetches into cfg2.
+ in configuration @cfg1:
+ pkg1 configured 0.1.0-a.0.19700101000000#1
+ % libprj configured 0.+%
+ pkg2 configured 0.1.0-a.0.19700101000000#1
+
+ in configuration @cfg2:
+ pkg1 configured 0.1.0-a.0.19700101000000 available 0.1.0-a.0.19700101000000#1
+ pkg2 configured 0.1.0-a.0.19700101000000 available 0.1.0-a.0.19700101000000#1
+ EOO
+ fetching dir:$~/libprj \(prerequisite of dir:$~/prj\)
+ EOE
+
+ # Sync all configurations (via the project directory).
+ #
+ $* --all -d prj 2>>~%EOE%;
+ in configuration @cfg1:
+
+ in configuration @cfg2:
+ synchronizing:
+ % new libprj.+ \(required by pkg1\)%
+ upgrade pkg1/0.1.0-a.0.19700101000000#1
+ upgrade pkg2/0.1.0-a.0.19700101000000#1
+ EOE
+
+ $status >>~%EOE%;
+ in configuration @cfg1:
+ pkg1 configured 0.1.0-a.0.19700101000000#1
+ % libprj configured 0.+%
+ pkg2 configured 0.1.0-a.0.19700101000000#1
+
+ in configuration @cfg2:
+ pkg1 configured 0.1.0-a.0.19700101000000#1
+ % libprj configured 0.+%
+ pkg2 configured 0.1.0-a.0.19700101000000#1
+ EOE
+
+ $build prj/pkg1/ 2>>~%EOE%;
+ %(mkdir|version\.in|c\+\+|ld|ln) .+%{8}
+ EOE
+
+ $build prj/pkg2/ 2>>~%EOE%;
+ %(mkdir|c\+\+|ld|ln) .+%{4}
+ EOE
+
+ $build 'clean:' prj/pkg1/ 2>>~%EOE%;
+ %rm .+%{3}
+ EOE
+
+ $build 'clean:' prj/pkg2/ 2>>~%EOE%;
+ %rm .+%{3}
+ EOE
+
+ $deinit 2>>/"EOE"
+ deinitializing in project $~/prj/
+ deinitializing package pkg1
+ deinitializing package pkg2
+ synchronizing:
+ drop pkg1
+ drop libprj
+ drop pkg2
+ EOE
+}