aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-08-09 20:17:14 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-08-09 20:17:14 +0300
commit30f6a563fc8c5b2d5c70cd55838aca4e5692b3e4 (patch)
tree581410c954a633dfb5f5ad31db40193dbd943362
parent4f2d4022dca65da2a6f03e1f27df13deeaab360a (diff)
Fix init, config and status commands tests to pass for older git versions
-rw-r--r--tests/buildfile2
-rw-r--r--tests/config.test34
-rw-r--r--tests/init.test33
-rw-r--r--tests/project.test6
-rw-r--r--tests/publish.test2
-rw-r--r--tests/status.test22
6 files changed, 56 insertions, 43 deletions
diff --git a/tests/buildfile b/tests/buildfile
index 6ab9123..70a012b 100644
--- a/tests/buildfile
+++ b/tests/buildfile
@@ -5,6 +5,6 @@
define common: file
common{*}: extension = test
-commons = common project
+commons = common git project
./: test{* -{$commons}} common{$commons} $bdep
diff --git a/tests/config.test b/tests/config.test
index 5beabcf..5e18427 100644
--- a/tests/config.test
+++ b/tests/config.test
@@ -5,10 +5,12 @@
# Note that we test the list sub-command while testing other sub-commands.
#
-.include common.test project.test
+.include common.test git.test project.test
cxx = cc "config.cxx=$config.cxx"
+snapshot = ($git_supported ? '19700101000000' : 'z')
+
status += -d prj
init += -d prj
update += -d prj
@@ -31,10 +33,10 @@ deinit += -d prj
$init @cfg 2>>/~"%EOE%";
initializing in project $~/prj/
synchronizing:
- % new prj.+19700101000000%
+ % new prj.+$snapshot%
EOE
- $status >'prj configured 0.1.0-a.0.19700101000000';
+ $status >"prj configured 0.1.0-a.0.$snapshot";
$* list @cfg >>/"EOO";
@cfg $~/cfg-dir/ 1 default,forwarded,auto-synchronized
@@ -65,10 +67,10 @@ deinit += -d prj
$init @cfg 2>>/~"%EOE%";
initializing in project $~/prj/
synchronizing:
- % new prj.+19700101000000%
+ % new prj.+$snapshot%
EOE
- $status >'prj configured 0.1.0-a.0.19700101000000';
+ $status >"prj configured 0.1.0-a.0.$snapshot";
$* list >>/"EOO";
@cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized
@@ -99,10 +101,10 @@ deinit += -d prj
$init -c cfg 2>>/~"%EOE%";
initializing in project $~/prj/
synchronizing:
- % new prj.+19700101000000%
+ % new prj.+$snapshot%
EOE
- $status >'prj configured 0.1.0-a.0.19700101000000';
+ $status >"prj configured 0.1.0-a.0.$snapshot";
$* list >>/"EOO";
$~/cfg/ 1 default,forwarded,auto-synchronized
@@ -162,19 +164,19 @@ deinit += -d prj
initializing in project $~/prj/
in configuration @cfg1:
synchronizing:
- % new prj.+19700101000000%
+ % new prj.+$snapshot%
in configuration @cfg2:
synchronizing:
- % new prj.+19700101000000%
+ % new prj.+$snapshot%
EOE
- $status --all >>EOO;
+ $status --all >>"EOO";
in configuration @cfg1:
- prj configured 0.1.0-a.0.19700101000000
+ prj configured 0.1.0-a.0.$snapshot
in configuration @cfg2:
- prj configured 0.1.0-a.0.19700101000000
+ prj configured 0.1.0-a.0.$snapshot
EOO
$* list >>/"EOO";
@@ -218,7 +220,7 @@ deinit += -d prj
$init @cfg 2>>/~"%EOE%";
initializing in project $~/prj/
synchronizing:
- % new prj.+19700101000000%
+ % new prj.+$snapshot%
EOE
mv prj-cfg prj-cfg2;
@@ -252,7 +254,7 @@ deinit += -d prj
$init @cfg 2>>/~"%EOE%";
initializing in project $~/prj/
synchronizing:
- % new prj.+19700101000000%
+ % new prj.+$snapshot%
EOE
$* rename @cfg cfg2 2>>/"EOE";
@@ -300,8 +302,8 @@ deinit += -d prj
removed configuration @cfg1 $~/prj-cfg1/ 1
EOE
- $status --all >>EOO;
- prj configured 0.1.0-a.0.19700101000000
+ $status --all >>"EOO";
+ prj configured 0.1.0-a.0.$snapshot
EOO
$* list >>/"EOO";
diff --git a/tests/init.test b/tests/init.test
index 8915189..659b294 100644
--- a/tests/init.test
+++ b/tests/init.test
@@ -5,10 +5,12 @@
# Here we test both init and deinit commands.
#
-.include common.test project.test
+.include common.test git.test project.test
cxx = cc "config.cxx=$config.cxx"
+snapshot = ($git_supported ? '19700101000000' : 'z')
+
status += -d prj
deinit += -d prj
@@ -24,13 +26,13 @@ deinit += -d prj
initializing in project $~/prj/
created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized
synchronizing:
- % new prj.+19700101000000%
+ % new prj.+$snapshot%
EOE
sed -n -e 's/^config.cc.poptions = (.+)$/\1/p' prj-cfg/build/config.build \
>'-DTEST';
- $status >'prj configured 0.1.0-a.0.19700101000000';
+ $status >"prj configured 0.1.0-a.0.$snapshot";
$build prj/ 2>>/EOE;
mkdir prj-cfg/prj/fsdir{prj/}
@@ -72,22 +74,22 @@ deinit += -d prj
initializing in project $~/prj/
added configuration @cfg1 $~/prj-cfg1/ 1 default,forwarded,auto-synchronized
synchronizing:
- % new prj.+19700101000000%
+ % new prj.+$snapshot%
EOE
$* -A prj-cfg2 @cfg2 2>>/~"%EOE%";
initializing in project $~/prj/
added configuration @cfg2 $~/prj-cfg2/ 2 auto-synchronized
synchronizing:
- % new prj.+19700101000000%
+ % new prj.+$snapshot%
EOE
- $status --all >>EOO;
+ $status --all >>"EOO";
in configuration @cfg1:
- prj configured 0.1.0-a.0.19700101000000
+ prj configured 0.1.0-a.0.$snapshot
in configuration @cfg2:
- prj configured 0.1.0-a.0.19700101000000
+ prj configured 0.1.0-a.0.$snapshot
EOO
$build prj-cfg1/ 2>>/~%EOE%;
@@ -134,10 +136,10 @@ deinit += -d prj
initializing in project $~/prj/
created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized
synchronizing:
- % new prj.+19700101000000%
+ % new prj.+$snapshot%
EOE
- $status >'prj configured 0.1.0-a.0.19700101000000';
+ $status >"prj configured 0.1.0-a.0.$snapshot";
$build prj/ 2>>/EOE;
mkdir prj-cfg/prj/fsdir{prj/}
@@ -150,7 +152,10 @@ deinit += -d prj
#
mkdir --no-cleanup prj/prj.pkg;
- mv prj/prj prj/build prj/buildfile prj/manifest prj/.gitignore prj/prj.pkg/;
+ mv prj/prj prj/build prj/buildfile prj/manifest prj/prj.pkg/;
+ if ($git_supported)
+ mv prj/.gitignore prj/prj.pkg/
+ end;
mv prj/prj.pkg prj/prj;
cat <<EOI >=prj/packages.manifest;
@@ -167,8 +172,8 @@ deinit += -d prj
$init --all -d prj/libprj 2>>/~"%EOE%";
initializing in project $~/prj/
synchronizing:
- % upgrade prj.+19700101000000#1%
- % new libprj.+19700101000000%
+ % upgrade prj.+$snapshot#1%
+ % new libprj.+$snapshot%
EOE
# Factor out some of the executable package functionality into the library.
@@ -201,7 +206,7 @@ deinit += -d prj
$build prj-cfg/prj/ 2>>/~"%EOE%";
synchronizing $~/prj-cfg/:
- % upgrade prj.+19700101000000#2%
+ % upgrade prj.+$snapshot#2%
%mkdir prj-cfg/.+%{2}
%.{3}
%ld prj-cfg/.+%{2}
diff --git a/tests/project.test b/tests/project.test
index 6ab2b4b..444ca00 100644
--- a/tests/project.test
+++ b/tests/project.test
@@ -2,6 +2,8 @@
# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
+.include git.test
+
# Create and initialize a sample build2 C++ executable project that will be
# copied by subsequent tests and scopes setup commands. The common approach
# will be that group scopes copy and modify the parent scope project as
@@ -10,7 +12,9 @@
# project can not be shared between multiple bdep processes. Also we need to
# make sure that projects are not cloned while being used by bdep.
#
-+$new prj 2>- &prj/*** # By default: -t exe -l c++.
+# By default: -t exe -l c++.
+#
++$new prj --vcs ($git_supported ? git : none) 2>- &prj/***
# The most commonly used project cloning command that copies it from the
# parent scope working directory.
diff --git a/tests/publish.test b/tests/publish.test
index 947a780..b2a994f 100644
--- a/tests/publish.test
+++ b/tests/publish.test
@@ -2,7 +2,7 @@
# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-.include common.test project.test git.test
+.include common.test git.test project.test
# Repository to use for the package submissions simulation.
#
diff --git a/tests/status.test b/tests/status.test
index 676dac0..66de654 100644
--- a/tests/status.test
+++ b/tests/status.test
@@ -2,10 +2,12 @@
# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-.include common.test project.test
+.include common.test git.test project.test
cxx = cc "config.cxx=$config.cxx"
+snapshot = ($git_supported ? '19700101000000' : 'z')
+
new += 2>!
init += $cxx -d prj 2>!
sync += -d prj 2>!
@@ -29,7 +31,7 @@ deinit += -d prj
$init -C @cfg &prj-cfg/***;
- $* >'prj configured 0.1.0-a.0.19700101000000';
+ $* >"prj configured 0.1.0-a.0.$snapshot";
$deinit 2>>/"EOE"
deinitializing in project $~/prj/
@@ -46,14 +48,14 @@ deinit += -d prj
$init -C @cfg1 &prj-cfg1/***;
$init -C @cfg2 &prj-cfg2/***;
- $* @cfg2 >'prj configured 0.1.0-a.0.19700101000000';
+ $* @cfg2 >"prj configured 0.1.0-a.0.$snapshot";
- $* --all >>EOO;
+ $* --all >>"EOO";
in configuration @cfg1:
- prj configured 0.1.0-a.0.19700101000000
+ prj configured 0.1.0-a.0.$snapshot
in configuration @cfg2:
- prj configured 0.1.0-a.0.19700101000000
+ prj configured 0.1.0-a.0.$snapshot
EOO
$deinit 2>>/"EOE"
@@ -83,16 +85,16 @@ deinit += -d prj
depends: libprj
EOI
- $* --recursive >>EOO 2>>/"EOE"; # Note: implicitly fetches in cfg.
- prj configured 0.1.0-a.0.19700101000000 available 0.1.0-a.0.19700101000000#1
+ $* --recursive >>"EOO" 2>>/"EOE"; # Note: implicitly fetches in cfg.
+ prj configured 0.1.0-a.0.$snapshot available 0.1.0-a.0.$snapshot#1
EOO
fetching dir:$~/libprj \(prerequisite of dir:$~/prj\)
EOE
$sync;
- $* --recursive >>~%EOO%;
- prj configured 0.1.0-a.0.19700101000000#1
+ $* --recursive >>~"%EOO%";
+ prj configured 0.1.0-a.0.$snapshot#1
% libprj configured 0.+%
EOO