diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/buildfile | 2 | ||||
-rw-r--r-- | tests/common.test | 22 | ||||
-rw-r--r-- | tests/config.test | 34 | ||||
-rw-r--r-- | tests/git.test | 23 | ||||
-rw-r--r-- | tests/init.test | 28 | ||||
-rw-r--r-- | tests/new.test | 10 | ||||
-rw-r--r-- | tests/project.test | 6 | ||||
-rw-r--r-- | tests/publish.test | 2 | ||||
-rw-r--r-- | tests/status.test | 22 | ||||
-rw-r--r-- | tests/sync.test | 30 | ||||
-rw-r--r-- | tests/test.test | 8 |
11 files changed, 87 insertions, 100 deletions
diff --git a/tests/buildfile b/tests/buildfile index 70a012b..6ab9123 100644 --- a/tests/buildfile +++ b/tests/buildfile @@ -5,6 +5,6 @@ define common: file common{*}: extension = test -commons = common git project +commons = common project ./: test{* -{$commons}} common{$commons} $bdep diff --git a/tests/common.test b/tests/common.test index 8de78d7..46f4abc 100644 --- a/tests/common.test +++ b/tests/common.test @@ -15,6 +15,26 @@ build = $recall($build.path) test.options += --build $build +# Check that git version is the minimum supported one (2.12.0) or above. +# ++git --version | set git_version_out + ++echo "$git_version_out" | sed -n -e 's/git version (\d+\.\d+\.\d+).*/\1/p' | \ + set git_version + ++if ("$git_version" == "") + exit "unable to obtain git version from '$git_version_out'" +end + ++echo "$git_version" | sed -e 's/(\d+).*/\1/' | set git_version_major ++echo "$git_version" | sed -e 's/\d+\.(\d+).*/\1/' | set git_version_minor + +# This flag must be used by testscripts to decide if they should skip git +# repository-related tests. +# +git_supported = ($git_version_major > 2 || \ + $git_version_major == 2 && $git_version_minor >= 12) + # Helper commands that can be used by tests to prepare the testing environment # or validate an outcome of the command being tested. They are likely to get # additional options and redirects appended prior to use. A common approach @@ -27,7 +47,7 @@ clean = $* clean deinit = $* deinit init = $* init fetch = $* fetch -new = $* new --no-checks +new = $* new --no-checks --vcs ($git_supported ? git : none) status = $* status sync = $* sync update = $* update diff --git a/tests/config.test b/tests/config.test index 5e18427..7c03286 100644 --- a/tests/config.test +++ b/tests/config.test @@ -5,12 +5,10 @@ # Note that we test the list sub-command while testing other sub-commands. # -.include common.test git.test project.test +.include common.test project.test cxx = cc "config.cxx=$config.cxx" -snapshot = ($git_supported ? '19700101000000' : 'z') - status += -d prj init += -d prj update += -d prj @@ -33,10 +31,10 @@ deinit += -d prj $init @cfg 2>>/~"%EOE%"; initializing in project $~/prj/ synchronizing: - % new prj.+$snapshot% + % new prj.+% EOE - $status >"prj configured 0.1.0-a.0.$snapshot"; + $status >~'%prj configured 0\.1\.0-a\.0\..+%'; $* list @cfg >>/"EOO"; @cfg $~/cfg-dir/ 1 default,forwarded,auto-synchronized @@ -67,10 +65,10 @@ deinit += -d prj $init @cfg 2>>/~"%EOE%"; initializing in project $~/prj/ synchronizing: - % new prj.+$snapshot% + % new prj.+% EOE - $status >"prj configured 0.1.0-a.0.$snapshot"; + $status >~'%prj configured 0\.1\.0-a\.0\..+%'; $* list >>/"EOO"; @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized @@ -101,10 +99,10 @@ deinit += -d prj $init -c cfg 2>>/~"%EOE%"; initializing in project $~/prj/ synchronizing: - % new prj.+$snapshot% + % new prj.+% EOE - $status >"prj configured 0.1.0-a.0.$snapshot"; + $status >~'%prj configured 0\.1\.0-a\.0\..+%'; $* list >>/"EOO"; $~/cfg/ 1 default,forwarded,auto-synchronized @@ -164,19 +162,19 @@ deinit += -d prj initializing in project $~/prj/ in configuration @cfg1: synchronizing: - % new prj.+$snapshot% + % new prj.+% in configuration @cfg2: synchronizing: - % new prj.+$snapshot% + % new prj.+% EOE - $status --all >>"EOO"; + $status --all >>~%EOO%; in configuration @cfg1: - prj configured 0.1.0-a.0.$snapshot + %prj configured 0\.1\.0-a\.0\..+% in configuration @cfg2: - prj configured 0.1.0-a.0.$snapshot + %prj configured 0\.1\.0-a\.0\..+% EOO $* list >>/"EOO"; @@ -220,7 +218,7 @@ deinit += -d prj $init @cfg 2>>/~"%EOE%"; initializing in project $~/prj/ synchronizing: - % new prj.+$snapshot% + % new prj.+% EOE mv prj-cfg prj-cfg2; @@ -254,7 +252,7 @@ deinit += -d prj $init @cfg 2>>/~"%EOE%"; initializing in project $~/prj/ synchronizing: - % new prj.+$snapshot% + % new prj.+% EOE $* rename @cfg cfg2 2>>/"EOE"; @@ -302,8 +300,8 @@ deinit += -d prj removed configuration @cfg1 $~/prj-cfg1/ 1 EOE - $status --all >>"EOO"; - prj configured 0.1.0-a.0.$snapshot + $status --all >>~%EOO%; + %prj configured 0\.1\.0-a\.0\..+% EOO $* list >>/"EOO"; diff --git a/tests/git.test b/tests/git.test deleted file mode 100644 index 41d97e9..0000000 --- a/tests/git.test +++ /dev/null @@ -1,23 +0,0 @@ -# file : tests/git.test -# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd -# license : MIT; see accompanying LICENSE file - -# Check that git version is the minimum supported one (2.12.0) or above. -# -+git --version | set git_version_out - -+echo "$git_version_out" | sed -n -e 's/git version (\d+\.\d+\.\d+).*/\1/p' | \ - set git_version - -+if ("$git_version" == "") - exit "unable to obtain git version from '$git_version_out'" -end - -+echo "$git_version" | sed -e 's/(\d+).*/\1/' | set git_version_major -+echo "$git_version" | sed -e 's/\d+\.(\d+).*/\1/' | set git_version_minor - -# This flag must be used by testscripts to decide if they should skip git -# repository-related tests. -# -git_supported = ($git_version_major > 2 || \ - $git_version_major == 2 && $git_version_minor >= 12) diff --git a/tests/init.test b/tests/init.test index 659b294..2fb3945 100644 --- a/tests/init.test +++ b/tests/init.test @@ -5,12 +5,10 @@ # Here we test both init and deinit commands. # -.include common.test git.test project.test +.include common.test project.test cxx = cc "config.cxx=$config.cxx" -snapshot = ($git_supported ? '19700101000000' : 'z') - status += -d prj deinit += -d prj @@ -26,13 +24,13 @@ deinit += -d prj initializing in project $~/prj/ created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized synchronizing: - % new prj.+$snapshot% + % new prj.+% EOE sed -n -e 's/^config.cc.poptions = (.+)$/\1/p' prj-cfg/build/config.build \ >'-DTEST'; - $status >"prj configured 0.1.0-a.0.$snapshot"; + $status >~'%prj configured 0\.1\.0-a\.0\..+%'; $build prj/ 2>>/EOE; mkdir prj-cfg/prj/fsdir{prj/} @@ -74,22 +72,22 @@ deinit += -d prj initializing in project $~/prj/ added configuration @cfg1 $~/prj-cfg1/ 1 default,forwarded,auto-synchronized synchronizing: - % new prj.+$snapshot% + % new prj.+% EOE $* -A prj-cfg2 @cfg2 2>>/~"%EOE%"; initializing in project $~/prj/ added configuration @cfg2 $~/prj-cfg2/ 2 auto-synchronized synchronizing: - % new prj.+$snapshot% + % new prj.+% EOE - $status --all >>"EOO"; + $status --all >>~%EOO%; in configuration @cfg1: - prj configured 0.1.0-a.0.$snapshot + %prj configured 0\.1\.0-a\.0\..+% in configuration @cfg2: - prj configured 0.1.0-a.0.$snapshot + %prj configured 0\.1\.0-a\.0\..+% EOO $build prj-cfg1/ 2>>/~%EOE%; @@ -136,10 +134,10 @@ deinit += -d prj initializing in project $~/prj/ created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized synchronizing: - % new prj.+$snapshot% + % new prj.+% EOE - $status >"prj configured 0.1.0-a.0.$snapshot"; + $status >~'%prj configured 0\.1\.0-a\.0\..+%'; $build prj/ 2>>/EOE; mkdir prj-cfg/prj/fsdir{prj/} @@ -172,8 +170,8 @@ deinit += -d prj $init --all -d prj/libprj 2>>/~"%EOE%"; initializing in project $~/prj/ synchronizing: - % upgrade prj.+$snapshot#1% - % new libprj.+$snapshot% + % upgrade prj.+#1% + % new libprj.+% EOE # Factor out some of the executable package functionality into the library. @@ -206,7 +204,7 @@ deinit += -d prj $build prj-cfg/prj/ 2>>/~"%EOE%"; synchronizing $~/prj-cfg/: - % upgrade prj.+$snapshot#2% + % upgrade prj.+#2% %mkdir prj-cfg/.+%{2} %.{3} %ld prj-cfg/.+%{2} diff --git a/tests/new.test b/tests/new.test index 3a62df3..089be60 100644 --- a/tests/new.test +++ b/tests/new.test @@ -6,7 +6,7 @@ # Disable nesting checks in the created projects. # -test.arguments += --no-checks +test.arguments += --no-checks --vcs ($git_supported ? git : none) cxx = "config.cxx=$config.cxx" @@ -104,10 +104,10 @@ status += -d prj created new executable project prj in $~/prj/ created configuration @cfg $~/prj-config/ 1 default,forwarded,auto-synchronized synchronizing: - % new prj.+19700101000000% + % new prj.+% EOE - $status >'prj configured 0.1.0-a.0.19700101000000'; + $status >~'%prj configured 0\.1\.0-a\.0\..+%'; $build prj/ 2>>/EOE mkdir prj-config/prj/fsdir{prj/} @@ -129,10 +129,10 @@ status += -d prj created new executable project prj in $~/prj/ created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized synchronizing: - % new prj.+19700101000000% + % new prj.+% EOE - $status >'prj configured 0.1.0-a.0.19700101000000'; + $status >~'%prj configured 0\.1\.0-a\.0\..+%'; $build prj/ 2>>/EOE mkdir prj-cfg/prj/fsdir{prj/} diff --git a/tests/project.test b/tests/project.test index 444ca00..6ab2b4b 100644 --- a/tests/project.test +++ b/tests/project.test @@ -2,8 +2,6 @@ # 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 @@ -12,9 +10,7 @@ # 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. # -# By default: -t exe -l c++. -# -+$new prj --vcs ($git_supported ? git : none) 2>- &prj/*** ++$new prj 2>- &prj/*** # By default: -t exe -l c++. # 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 b2a994f..dbdcabd 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 git.test project.test +.include common.test project.test # Repository to use for the package submissions simulation. # diff --git a/tests/status.test b/tests/status.test index 66de654..12ccc34 100644 --- a/tests/status.test +++ b/tests/status.test @@ -2,12 +2,10 @@ # copyright : Copyright (c) 2014-2018 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -.include common.test git.test project.test +.include common.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>! @@ -31,7 +29,7 @@ deinit += -d prj $init -C @cfg &prj-cfg/***; - $* >"prj configured 0.1.0-a.0.$snapshot"; + $* >~'%prj configured 0\.1\.0-a\.0\..+%'; $deinit 2>>/"EOE" deinitializing in project $~/prj/ @@ -48,14 +46,14 @@ deinit += -d prj $init -C @cfg1 &prj-cfg1/***; $init -C @cfg2 &prj-cfg2/***; - $* @cfg2 >"prj configured 0.1.0-a.0.$snapshot"; + $* @cfg2 >~'%prj configured 0\.1\.0-a\.0\..+%'; - $* --all >>"EOO"; + $* --all >>~%EOO%; in configuration @cfg1: - prj configured 0.1.0-a.0.$snapshot + %prj configured 0\.1\.0-a\.0\..+% in configuration @cfg2: - prj configured 0.1.0-a.0.$snapshot + %prj configured 0\.1\.0-a\.0\..+% EOO $deinit 2>>/"EOE" @@ -85,16 +83,16 @@ deinit += -d prj depends: libprj EOI - $* --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 + $* --recursive >>~%EOO% 2>>/"EOE"; # Note: implicitly fetches in cfg. + %prj configured 0\.1\.0-a\.0\..+ available 0\.1\.0-a\.0\..+#1% EOO fetching dir:$~/libprj \(prerequisite of dir:$~/prj\) EOE $sync; - $* --recursive >>~"%EOO%"; - prj configured 0.1.0-a.0.$snapshot#1 + $* --recursive >>~%EOO%; + %prj configured 0\.1\.0-a\.0\..+#1% % libprj configured 0.+% EOO diff --git a/tests/sync.test b/tests/sync.test index c086a02..842c2e1 100644 --- a/tests/sync.test +++ b/tests/sync.test @@ -55,11 +55,11 @@ deinit += -d prj fetching dir:$~/libprj \(prerequisite of dir:$~/prj\) synchronizing: % new libprj.+ \\\(required by prj\\\)% - % upgrade prj.+19700101000000#1% + % upgrade prj.+#1% EOE - $status >>~%EOO%; - prj configured 0.1.0-a.0.19700101000000#1 + $status >>~"%EOO%"; + %prj configured 0\.1\.0-a\.0\..+#1% % libprj configured 0.+% EOO @@ -140,19 +140,19 @@ deinit += -d prj fetching dir:$~/libprj \(prerequisite of dir:$~/prj\) synchronizing: % new libprj.+ \\\(required by pkg1\\\)% - % upgrade pkg1.+19700101000000#1% - % upgrade pkg2.+19700101000000#1% + % upgrade pkg1.+#1% + % upgrade pkg2.+#1% EOE $status >>~%EOO% 2>>/~"%EOE%"; # Note: implicitly fetches into cfg2. in configuration @cfg1: - pkg1 configured 0.1.0-a.0.19700101000000#1 + %pkg1 configured 0\.1\.0-a\.0\..+#1% % libprj configured 0.+% - pkg2 configured 0.1.0-a.0.19700101000000#1 + %pkg2 configured 0\.1\.0-a\.0\..+#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 + %pkg1 configured 0\.1\.0-a\.0\..+ available 0\.1\.0-a\.0\..+#1% + %pkg2 configured 0\.1\.0-a\.0\..+ available 0\.1\.0-a\.0\..+#1% EOO fetching dir:$~/libprj \(prerequisite of dir:$~/prj\) EOE @@ -165,20 +165,20 @@ deinit += -d prj 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 + % upgrade pkg1/0\.1\.0-a\.0\..+#1% + % upgrade pkg2/0\.1\.0-a\.0\..+#1% EOE $status >>~%EOE%; in configuration @cfg1: - pkg1 configured 0.1.0-a.0.19700101000000#1 + %pkg1 configured 0\.1\.0-a\.0\..+#1% % libprj configured 0.+% - pkg2 configured 0.1.0-a.0.19700101000000#1 + %pkg2 configured 0\.1\.0-a\.0\..+#1% in configuration @cfg2: - pkg1 configured 0.1.0-a.0.19700101000000#1 + %pkg1 configured 0\.1\.0-a\.0\..+#1% % libprj configured 0.+% - pkg2 configured 0.1.0-a.0.19700101000000#1 + %pkg2 configured 0\.1\.0-a\.0\..+#1% EOE $build prj/pkg1/ 2>>/~%EOE%; diff --git a/tests/test.test b/tests/test.test index 33952d5..713a25f 100644 --- a/tests/test.test +++ b/tests/test.test @@ -85,8 +85,8 @@ deinit += -d prj fetching dir:$~/libprj \(prerequisite of dir:$~/prj\) synchronizing: % new libprj.+ \\\(required by pkg1\\\)% - % upgrade pkg1.+19700101000000#1% - % upgrade pkg2.+19700101000000#1% + % upgrade pkg1.+#1% + % upgrade pkg2.+#1% mkdir prj-cfg1/pkg2/fsdir{pkg2/} c++ prj/pkg2/pkg2/cxx{pkg2}@prj-cfg1/pkg2/pkg2/ ld prj-cfg1/pkg2/pkg2/exe{pkg2} @@ -97,8 +97,8 @@ deinit += -d prj fetching dir:$~/libprj \(prerequisite of dir:$~/prj\) synchronizing: % new libprj.+ \\\(required by pkg1\\\)% - % upgrade pkg1.+19700101000000#1% - % upgrade pkg2.+19700101000000#1% + % upgrade pkg1.+#1% + % upgrade pkg2.+#1% mkdir prj-cfg2/pkg2/fsdir{pkg2/} c++ prj/pkg2/pkg2/cxx{pkg2}@prj-cfg2/pkg2/pkg2/ ld prj-cfg2/pkg2/pkg2/exe{pkg2} |