From 07ab59a93f9447d5489743e8d7e19b6adb5ebbf1 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 9 Jul 2021 20:55:15 +0300 Subject: Add support for configuration type and bdep-config-link sub-command --- tests/ci.testscript | 26 ++++++++++++++- tests/config.testscript | 85 ++++++++++++++++++++++++++++++++++++------------ tests/init.testscript | 18 +++++----- tests/new.testscript | 4 +-- tests/publish.testscript | 44 +++++++++++++++++++++++-- tests/update.testscript | 43 ++++++++++++++++++++++++ 6 files changed, 186 insertions(+), 34 deletions(-) (limited to 'tests') diff --git a/tests/ci.testscript b/tests/ci.testscript index d0407b5..bc3174f 100644 --- a/tests/ci.testscript +++ b/tests/ci.testscript @@ -102,7 +102,11 @@ windows = ($cxx.target.class == 'windows') $init -C @cfg1 &prj-cfg1/***; $init -C @cfg2 &prj-cfg2/***; - $* --all 2>'error: multiple configurations specified for ci' != 0 + $* --all 2>>EOE != 0 + error: package prj is initialized in multiple specified configurations + info: @cfg1 + info: @cfg2 + EOE } : no-commits @@ -393,6 +397,26 @@ windows = ($cxx.target.class == 'windows') EOE } + : diff-configs + : + { + $clone_prj; + $init -C @cfg1 -d prj/libprj &prj-cfg1/***; + + # While at it, test that we fail for uninitialized package. + # + $* -d prj/prj 2>>EOE != 0; + error: package prj is not initialized in any configuration + EOE + + $init -C @cfg2 --config-type host -d prj/prj &prj-cfg2/***; + + $* 2>>~%EOE% + %CI request is queued.*% + %reference: .+% + EOE + } + : single : { diff --git a/tests/config.testscript b/tests/config.testscript index db02947..cb8ed7e 100644 --- a/tests/config.testscript +++ b/tests/config.testscript @@ -22,10 +22,10 @@ deinit += -d prj $clone_root_prj; $* create @cfg cfg-dir $config_cxx 2>>/"EOE" &cfg-dir/***; - created configuration @cfg $~/cfg-dir/ 1 default,forwarded,auto-synchronized + created configuration @cfg $~/cfg-dir/ 1 target default,forwarded,auto-synchronized EOE - $status 2>'error: package prj is not initialized in configuration @cfg' != 0; + $status 2>'error: package prj is not initialized in any default configuration(s)' != 0; $init @cfg 2>>/~"%EOE%"; initializing in project $~/prj/ @@ -36,7 +36,7 @@ deinit += -d prj $status >'prj configured 0.1.0-a.0.19700101000000'; $* list @cfg >>/"EOO"; - @cfg $~/cfg-dir/ 1 default,forwarded,auto-synchronized + @cfg $~/cfg-dir/ 1 target default,forwarded,auto-synchronized EOO $update @cfg 2>>~%EOE%; @@ -56,7 +56,7 @@ deinit += -d prj $clone_root_prj; $* create -- @cfg $config_cxx 2>>/"EOE" &prj-cfg/***; - created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized + created configuration @cfg $~/prj-cfg/ 1 target default,forwarded,auto-synchronized EOE $init @cfg 2>>/~"%EOE%"; @@ -68,7 +68,7 @@ deinit += -d prj $status >'prj configured 0.1.0-a.0.19700101000000'; $* list >>/"EOO"; - @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized + @cfg $~/prj-cfg/ 1 target default,forwarded,auto-synchronized EOO $update @cfg 2>>~%EOE%; @@ -88,7 +88,7 @@ deinit += -d prj $clone_root_prj; $* create cfg $config_cxx 2>>/"EOE" &cfg/***; - created configuration $~/cfg/ 1 default,forwarded,auto-synchronized + created configuration $~/cfg/ 1 target default,forwarded,auto-synchronized EOE $init -c cfg 2>>/~"%EOE%"; @@ -100,7 +100,7 @@ deinit += -d prj $status >'prj configured 0.1.0-a.0.19700101000000'; $* list >>/"EOO"; - $~/cfg/ 1 default,forwarded,auto-synchronized + $~/cfg/ 1 target default,forwarded,auto-synchronized EOO $update -c cfg 2>>~%EOE%; @@ -114,6 +114,38 @@ deinit += -d prj EOE } + : type + : + { + $clone_root_prj; + + $* create --config-type host -- @cfg $config_cxx 2>>/"EOE" &prj-cfg/***; + created configuration @cfg $~/prj-cfg/ 1 host default,forwarded,auto-synchronized + EOE + + $init @cfg 2>>/~"%EOE%"; + initializing in project $~/prj/ + synchronizing: + % new prj.+19700101000000% + EOE + + $status >'prj configured 0.1.0-a.0.19700101000000'; + + $* list @cfg >>/"EOO"; + @cfg $~/prj-cfg/ 1 host default,forwarded,auto-synchronized + EOO + + $update @cfg 2>>~%EOE%; + %(mkdir|c\+\+|ld) .+%{3} + EOE + + $deinit @cfg 2>>/"EOE" + deinitializing in project $~/prj/ + synchronizing: + drop prj + EOE + } + : wipe : { @@ -128,7 +160,7 @@ deinit += -d prj EOE $* create --wipe cfg $config_cxx 2>>/"EOE" &cfg/*** - created configuration $~/cfg/ 1 default,forwarded,auto-synchronized + created configuration $~/cfg/ 1 target default,forwarded,auto-synchronized EOE } } @@ -144,11 +176,11 @@ deinit += -d prj $new -C prj-cfg2 tmp2 $config_cxx 2>! &prj-cfg2/*** &tmp2/***; $* add @cfg1 prj-cfg1 2>>/"EOE"; - added configuration @cfg1 $~/prj-cfg1/ 1 default,forwarded,auto-synchronized + added configuration @cfg1 $~/prj-cfg1/ 1 target default,forwarded,auto-synchronized EOE $* add @cfg2 prj-cfg2 2>>/"EOE"; - added configuration @cfg2 $~/prj-cfg2/ 2 auto-synchronized + added configuration @cfg2 $~/prj-cfg2/ 2 target auto-synchronized EOE $init --all 2>>/~"%EOE%"; @@ -171,8 +203,8 @@ deinit += -d prj EOO $* list >>/"EOO"; - @cfg1 $~/prj-cfg1/ 1 default,forwarded,auto-synchronized - @cfg2 $~/prj-cfg2/ 2 auto-synchronized + @cfg1 $~/prj-cfg1/ 1 target default,forwarded,auto-synchronized + @cfg2 $~/prj-cfg2/ 2 target auto-synchronized EOO $update --all 2>>~%EOE%; @@ -201,7 +233,7 @@ deinit += -d prj $clone_root_prj; $* create -- @cfg $config_cxx &prj-cfg/*** 2>>/"EOE"; - created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized + created configuration @cfg $~/prj-cfg/ 1 target default,forwarded,auto-synchronized EOE $init @cfg 2>>/~"%EOE%"; @@ -213,7 +245,7 @@ deinit += -d prj mv prj-cfg prj-cfg2; $* move @cfg prj-cfg2 2>>/"EOE"; - moved configuration @cfg $~/prj-cfg/ 1 to $~/prj-cfg2/ + moved configuration @cfg $~/prj-cfg/ 1 target to $~/prj-cfg2/ info: explicit sync command is required for changes to take effect EOE @@ -234,7 +266,7 @@ deinit += -d prj $clone_root_prj; $* create -- @cfg $config_cxx 2>>/"EOE" &prj-cfg/***; - created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized + created configuration @cfg $~/prj-cfg/ 1 target default,forwarded,auto-synchronized EOE $init @cfg 2>>/~"%EOE%"; @@ -244,7 +276,7 @@ deinit += -d prj EOE $* rename @cfg cfg2 2>>/"EOE"; - renamed configuration @cfg $~/prj-cfg/ 1 to @cfg2 + renamed configuration @cfg $~/prj-cfg/ 1 target to @cfg2 EOE $update @cfg2 2>>~%EOE%; @@ -283,7 +315,7 @@ deinit += -d prj EOE $* remove @cfg1 2>>/"EOE"; - removed configuration @cfg1 $~/prj-cfg1/ 1 + removed configuration @cfg1 $~/prj-cfg1/ 1 target EOE $status --all >>EOO; @@ -291,7 +323,7 @@ deinit += -d prj EOO $* list >>/"EOO"; - @cfg2 $~/prj-cfg2/ 2 auto-synchronized + @cfg2 $~/prj-cfg2/ 2 target auto-synchronized EOO $update 2>>/"EOE" != 0; @@ -300,12 +332,12 @@ deinit += -d prj EOE $* set @cfg2 --default --forward --no-auto-sync 2>>/"EOE"; - updated configuration @cfg2 $~/prj-cfg2/ 2 default,forwarded + updated configuration @cfg2 $~/prj-cfg2/ 2 target default,forwarded info: explicit sync command is required for changes to take effect EOE $* list >>/"EOO"; - @cfg2 $~/prj-cfg2/ 2 default,forwarded + @cfg2 $~/prj-cfg2/ 2 target default,forwarded EOO $update 2>>~%EOE%; @@ -318,3 +350,16 @@ deinit += -d prj drop prj EOE } + +: link +: +{ + $clone_root_prj; + + $* create -- @cfg1 $config_cxx 2>! &prj-cfg1/***; + $* create -- @cfg2 $config_cxx 2>! &prj-cfg2/***; + + $* link @cfg1 @cfg2 2>>EOE + linked configuration @cfg1 (target) with configuration @cfg2 (target) + EOE +} diff --git a/tests/init.testscript b/tests/init.testscript index ba67b56..5192145 100644 --- a/tests/init.testscript +++ b/tests/init.testscript @@ -27,7 +27,7 @@ deinit += -d prj $* -C @cfg $config_cxx 'config.cc.poptions=-DTEST' -- '?sys:libprj/*' 2>>/~"%EOE%" &prj-cfg/***; initializing in project $~/prj/ - created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized + created configuration @cfg $~/prj-cfg/ 1 target default,forwarded,auto-synchronized synchronizing: % configure sys:libprj.*% % new prj.+19700101000000% @@ -67,7 +67,7 @@ deinit += -d prj $* -C @cfg -- $config_cxx 'config.cc.poptions=-DTEST' -- '?sys:libprj/*' 2>>/~"%EOE%" &prj-cfg/***; initializing in project $~/prj/ - created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized + created configuration @cfg $~/prj-cfg/ 1 target default,forwarded,auto-synchronized synchronizing: % configure sys:libprj.*% % new prj.+19700101000000% @@ -99,7 +99,7 @@ deinit += -d prj $* -C @cfg -- -- '?sys:libprj/*' 2>>/~"%EOE%" &prj-cfg/***; initializing in project $~/prj/ - created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized + created configuration @cfg $~/prj-cfg/ 1 target default,forwarded,auto-synchronized synchronizing: % configure sys:libprj.*% % new prj.+19700101000000% @@ -125,20 +125,20 @@ deinit += -d prj # Pre-create configurations. # - $new -C prj-cfg1 tmp $config_cxx 2>! &prj-cfg1/*** &tmp/***; - $init -C prj-cfg2 -d tmp $config_cxx 2>! &prj-cfg2/***; + $new -C prj-cfg1 --no-default tmp $config_cxx 2>! &prj-cfg1/*** &tmp/***; + $init -C prj-cfg2 --config-type host -d tmp $config_cxx 2>! &prj-cfg2/***; $* -A @cfg1 '?sys:libprj/*' 2>>/~"%EOE%"; initializing in project $~/prj/ - added configuration @cfg1 $~/prj-cfg1/ 1 default,forwarded,auto-synchronized + added configuration @cfg1 $~/prj-cfg1/ 1 target default,forwarded,auto-synchronized synchronizing: % configure sys:libprj.*% % new prj.+19700101000000% EOE - $* -A prj-cfg2 @cfg2 '?sys:libprj/*' 2>>/~"%EOE%"; + $* -A prj-cfg2 --no-default @cfg2 '?sys:libprj/*' 2>>/~"%EOE%"; initializing in project $~/prj/ - added configuration @cfg2 $~/prj-cfg2/ 2 auto-synchronized + added configuration @cfg2 $~/prj-cfg2/ 2 host auto-synchronized synchronizing: % configure sys:libprj.*% % new prj.+19700101000000% @@ -188,7 +188,7 @@ deinit += -d prj $* -C @cfg $config_cxx 2>>/~"%EOE%" &prj-cfg/***; initializing in project $~/prj/ - created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized + created configuration @cfg $~/prj-cfg/ 1 target default,forwarded,auto-synchronized synchronizing: % new prj.+19700101000000% EOE diff --git a/tests/new.testscript b/tests/new.testscript index 4d98feb..727f338 100644 --- a/tests/new.testscript +++ b/tests/new.testscript @@ -1836,7 +1836,7 @@ subdir=hello,no-subdir-source \ { $* -C prj-config @cfg prj cc $config_cxx 2>>/~"%EOE%" &prj/*** &prj-config/***; created new executable project prj in $~/prj/ - created configuration @cfg $~/prj-config/ 1 default,forwarded,auto-synchronized + created configuration @cfg $~/prj-config/ 1 target default,forwarded,auto-synchronized synchronizing: % new prj.+19700101000000% EOE @@ -1858,7 +1858,7 @@ subdir=hello,no-subdir-source \ { $* -C -@cfg prj cc $config_cxx 2>>/~"%EOE%" &prj/*** &prj-cfg/***; created new executable project prj in $~/prj/ - created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized + created configuration @cfg $~/prj-cfg/ 1 target default,forwarded,auto-synchronized synchronizing: % new prj.+19700101000000% EOE diff --git a/tests/publish.testscript b/tests/publish.testscript index 8f5ec85..07c3632 100644 --- a/tests/publish.testscript +++ b/tests/publish.testscript @@ -33,7 +33,7 @@ g = git -C prj >! 2>! # duplicate submissions. We will use unique version for each test, # incrementing the patch version for 1.0.X. # -# Next version to use: 1.0.20 +# Next version to use: 1.0.22 # # Normally we disable the progress indication that complicates stderr output @@ -104,7 +104,11 @@ g = git -C prj >! 2>! $init -C @cfg1 &prj-cfg1/***; $init -C @cfg2 &prj-cfg2/***; - $* --all 2>'error: multiple configurations specified for publish' != 0 + $* --all 2>>EOE != 0 + error: package prj is initialized in multiple specified configurations + info: @cfg1 + info: @cfg2 + EOE } : snapshot @@ -152,6 +156,42 @@ g = git -C prj >! 2>! EOE } + : diff-configs + : + { + $clone_prj; + sed -i -e 's/^(version:) .*$/\1 1.0.20/' prj/libprj/manifest; + sed -i -e 's/^(version:) .*$/\1 1.0.20/' prj/prj/manifest; + + $init -C @cfg1 -d prj/libprj &prj-cfg1/***; + $init -C @cfg2 --config-type host -d prj/prj &prj-cfg2/***; + + $* 2>>~%EOE% + %package submission is queued(: \.*libprj/1.0.20)?%d + %reference: .{12}% + %package submission is queued(: \.*prj/1.0.20)?%d + %reference: .{12}% + EOE + } + + : diff-configs-forward + : + { + $clone_prj; + sed -i -e 's/^(version:) .*$/\1 1.0.21/' prj/libprj/manifest; + sed -i -e 's/^(version:) .*$/\1 1.0.21/' prj/prj/manifest; + + $init -C @cfg1 --no-default --forward -d prj/libprj &prj-cfg1/***; + $init -C @cfg2 --config-type host --no-default --forward -d prj/prj &prj-cfg2/***; + + $* --forward 2>>~%EOE% + %package submission is queued(: \.*libprj/1.0.21)?%d + %reference: .{12}% + %package submission is queued(: \.*prj/1.0.21)?%d + %reference: .{12}% + EOE + } + : single : { diff --git a/tests/update.testscript b/tests/update.testscript index 7e03238..3823b9d 100644 --- a/tests/update.testscript +++ b/tests/update.testscript @@ -88,3 +88,46 @@ deinit += -d prj drop pkg2 EOE } + +: multi-default-cfg +: +{ + $new -t empty prj &prj/***; + + $new --package pkg1 -d prj; + $new --package pkg2 -d prj; + + $init -C @cfg1 -d prj/pkg1 &prj-cfg1/***; + $init -C @cfg2 -d prj/pkg2 --config-type host &prj-cfg2/***; + + # Update. + # + $* -d prj 2>>~%EOE%; + in configuration @cfg1: + %(mkdir|c\+\+|ld) .+pkg1.+%{3} + + in configuration @cfg2: + %(mkdir|c\+\+|ld) .+pkg2.+%{3} + EOE + + # Clean. + # + $clean -d prj 2>>~%EOE%; + in configuration @cfg1: + %rm .+pkg1.+%{3} + + in configuration @cfg2: + %rm .+pkg2.+%{3} + EOE + + $deinit 2>>/"EOE" + deinitializing in project $~/prj/ + in configuration @cfg1: + synchronizing: + drop pkg1 + + in configuration @cfg2: + synchronizing: + drop pkg2 + EOE +} -- cgit v1.1