aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-07-10 18:50:28 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-07-11 21:16:44 +0300
commita1737cd518e8b25367efe33252a18b9b9e03c9ce (patch)
treea5aa72fccbaffaf86cbee2a2a25219d40a950a4f /tests
parent92838a856398b48315429b8cef8750a5df22af4a (diff)
Add regression test for (GH issue #359)
Diffstat (limited to 'tests')
-rw-r--r--tests/sync.testscript67
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/sync.testscript b/tests/sync.testscript
index 25b53a6..0bdfb16 100644
--- a/tests/sync.testscript
+++ b/tests/sync.testscript
@@ -384,3 +384,70 @@ deinit += -d prj
EOO
}
}
+
+: failure-preserve-user-config
+:
+{
+ $new -t empty -C @cfg prj $config_cxx &prj/*** &prj-cfg/***;
+
+ $new --package pkg -d prj;
+ $new --package -t lib libpkg -d prj;
+
+ echo 'depends: libpkg' >+prj/pkg/manifest;
+ sed -i -e 's/^#import.+$/import libs += libpkg%lib{pkg}/' prj/pkg/pkg/buildfile;
+
+ echo 'config [bool] config.pkg.feature ?= false' >+prj/pkg/build/root.build;
+ echo 'config [bool] config.libpkg.feature ?= false' >+prj/libpkg/build/root.build;
+
+ $init -d prj/ @cfg config.pkg.feature=true config.libpkg.feature=true;
+
+ sed -n -e 's/config.pkg.feature = (.+)/\1/p' \
+ prj-cfg/pkg/build/config.build >'true';
+
+ sed -n -e 's/config.libpkg.feature = (.+)/\1/p' \
+ prj-cfg/libpkg/build/config.build >'true';
+
+ mkdir --no-cleanup prj/libpkg/stray;
+ echo '' >+prj/libpkg/manifest;
+
+ $build prj/pkg/ 2>>~%EOE% != 0;
+ %synchronizing .*prj-cfg.:%
+ upgrade libpkg/0.1.0-a.0.19700101000000#1
+ config.libpkg.feature=true (user configuration)
+ reconfigure pkg/0.1.0-a.0.19700101000000
+ config.pkg.feature=true (user configuration)
+ %error: no explicit target for .+stray.+%
+ info: while configuring libpkg
+ %.*
+ EOE
+
+ sed -n -e 's/config.pkg.feature = (.+)/\1/p' \
+ prj-cfg/pkg/build/config.build >'true';
+
+ sed -n -e 's/config.libpkg.feature = (.+)/\1/p' \
+ prj-cfg/libpkg/build/config.build >'true';
+
+ rmdir prj/libpkg/stray;
+
+ $build prj/pkg/ 2>>~%EOE%;
+ %synchronizing .*prj-cfg.:%
+ update libpkg/0.1.0-a.0.19700101000000#1
+ update pkg/0.1.0-a.0.19700101000000
+ %(mkdir|version|c\+\+|ld|ln) .+%{8}
+ EOE
+
+ sed -n -e 's/config.pkg.feature = (.+)/\1/p' \
+ prj-cfg/pkg/build/config.build >'true';
+
+ sed -n -e 's/config.libpkg.feature = (.+)/\1/p' \
+ prj-cfg/libpkg/build/config.build >'true';
+
+ $deinit 2>>/"EOE"
+ deinitializing in project $~/prj/
+ deinitializing package pkg
+ deinitializing package libpkg
+ synchronizing:
+ drop pkg
+ drop libpkg
+ EOE
+}