aboutsummaryrefslogtreecommitdiff
path: root/tests/cfg-create.testscript
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cfg-create.testscript')
-rw-r--r--tests/cfg-create.testscript205
1 files changed, 204 insertions, 1 deletions
diff --git a/tests/cfg-create.testscript b/tests/cfg-create.testscript
index cb2f643..f22bd57 100644
--- a/tests/cfg-create.testscript
+++ b/tests/cfg-create.testscript
@@ -3,8 +3,11 @@
.include common.testscript
-config_cxx = config.cxx=$quote($recall($cxx.path) $cxx.mode, true)
+config_cxx = [cmdline] config.cxx=$quote($recall($cxx.path) $cxx.config.mode, true)
+cfg_create += 2>!
+
+cfg_info += -d cfg
pkg_status += -d cfg
: non-empty
@@ -25,8 +28,17 @@ EOE
{
$* 2>>/~%EOE%;
%created new configuration in .+/cfg/%
+ % uuid: .{36}%
+ type: target
EOE
+ $cfg_info >>/~"%EOO%";
+ %path: .+/cfg/%
+ %uuid: .{36}%
+ type: target
+ %name: %
+ EOO
+
$pkg_status libfoo >'libfoo unknown'
}
@@ -35,8 +47,17 @@ EOE
{
$* "config.install.root='$~/opt'" 2>>/~%EOE%;
%created new configuration in .+/cfg/%
+ % uuid: .{36}%
+ type: target
EOE
+ $cfg_info >>/~"%EOO%";
+ %path: .+/cfg/%
+ %uuid: .{36}%
+ type: target
+ %name: %
+ EOO
+
$pkg_status libfoo >'libfoo unknown';
cat cfg/build/config.build >>/~"%EOO%"
@@ -51,8 +72,17 @@ EOE
{
$* cxx $config_cxx 2>>/~%EOE%;
%created new configuration in .+/cfg/%
+ % uuid: .{36}%
+ type: target
EOE
+ $cfg_info >>/~"%EOO%";
+ %path: .+/cfg/%
+ %uuid: .{36}%
+ type: target
+ %name: %
+ EOO
+
$pkg_status libfoo >'libfoo unknown';
cat cfg/build/config.build >>/~"%EOO%"
@@ -69,8 +99,17 @@ EOE
$* --wipe 2>>/~%EOE%;
%created new configuration in .+/cfg/%
+ % uuid: .{36}%
+ type: target
EOE
+ $cfg_info >>/~"%EOO%";
+ %path: .+/cfg/%
+ %uuid: .{36}%
+ type: target
+ %name: %
+ EOO
+
$pkg_status libfoo >'libfoo unknown'
}
@@ -81,8 +120,172 @@ EOE
$* --existing 2>>/~%EOE%;
%initialized existing configuration in .+/cfg/%
+ % uuid: .{36}%
+ type: target
+ EOE
+
+ $cfg_info >>/~"%EOO%";
+ %path: .+/cfg/%
+ %uuid: .{36}%
+ type: target
+ %name: %
+ EOO
+
+ $pkg_status libfoo >'libfoo unknown'
+ }
+}
+
+: name
+:
+{
+ test.arguments += -d cfg
+
+ : valid
+ :
+ {
+ $* --name foo 2>>/~%EOE% &cfg/***;
+ %created new configuration in .+/cfg/%
+ % uuid: .{36}%
+ type: target
+ name: foo
+ EOE
+
+ $cfg_info >>/~"%EOO%";
+ %path: .+/cfg/%
+ %uuid: .{36}%
+ type: target
+ name: foo
+ EOO
+
+ $pkg_status libfoo >'libfoo unknown'
+ }
+
+ : invalid
+ :
+ : Also use the short option.
+ :
+ $* --name 123 2>>EOE != 0
+ error: invalid --name option value '123': illegal first character (must be alphabetic or underscore)
+ EOE
+}
+
+: type
+:
+{
+ test.arguments += -d cfg
+
+ : valid
+ :
+ {
+ $* --type host 2>>/~%EOE% &cfg/***;
+ %created new configuration in .+/cfg/%
+ % uuid: .{36}%
+ type: host
+ EOE
+
+ $cfg_info >>/~"%EOO%";
+ %path: .+/cfg/%
+ %uuid: .{36}%
+ type: host
+ %name: %
+ EOO
+
+ $pkg_status libfoo >'libfoo unknown'
+ }
+
+ : invalid
+ :
+ : Also use the short option.
+ :
+ $* --type '' 2>>EOE != 0
+ error: empty --type option value
+ EOE
+}
+
+: uuid
+:
+{
+ test.arguments += -d cfg
+
+ : valid
+ :
+ {
+ uuid='18f48b4b-b5d9-4712-b98c-1930df1c4228';
+
+ $* --uuid $uuid --name foo 2>>/~"%EOE%" &cfg/***;
+ %created new configuration in .+/cfg/%
+ uuid: $uuid
+ type: target
+ name: foo
+ EOE
+
+ $cfg_info >>/~"%EOO%";
+ %path: .+/cfg/%
+ uuid: $uuid
+ type: target
+ name: foo
+ EOO
+
+ $pkg_status libfoo >'libfoo unknown'
+ }
+
+ : invalid
+ :
+ : Also use the short option.
+ :
+ $* --uuid '123' 2>>EOE != 0
+ error: invalid value '123' for option '--uuid'
+ EOE
+}
+
+: link-config
+:
+{
+ test.arguments += -d cfg
+
+ : valid-type
+ :
+ {
+ $cfg_create -d host --type 'host' &host/***;
+ $cfg_create -d build2 --type 'build2' &build2/***;
+
+ $* --host-config host --build2-config build2 2>>/~%EOE% &cfg/***;
+ %created new configuration in .+/cfg/%
+ % uuid: .{36}%
+ type: target
EOE
+ $cfg_info --link >>/~"%EOO%";
+ %path: .+/cfg/%
+ %uuid: .{36}%
+ type: target
+ %name: %
+
+ %path: .+/host/%
+ %uuid: .{36}%
+ type: host
+ %name: %
+
+ %path: .+/build2/%
+ %uuid: .{36}%
+ type: build2
+ %name: %
+ EOO
+
$pkg_status libfoo >'libfoo unknown'
}
+
+ : invalid-type
+ :
+ {
+ $cfg_create -d cfg2 &cfg2/***;
+
+ $* --host-config cfg2 2>>/~%EOE% != 0;
+ %error: host configuration .+/cfg2/ is of 'target' type%
+ EOE
+
+ $* --build2-config cfg2 2>>/~%EOE% != 0
+ %error: build2 configuration .+/cfg2/ is of 'target' type%
+ EOE
+ }
}