aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ci.testscript41
-rw-r--r--tests/publish.testscript60
-rw-r--r--tests/status.testscript179
-rw-r--r--tests/sync.testscript61
-rw-r--r--tests/update.testscript42
5 files changed, 373 insertions, 10 deletions
diff --git a/tests/ci.testscript b/tests/ci.testscript
index 7f3e538..b051dfd 100644
--- a/tests/ci.testscript
+++ b/tests/ci.testscript
@@ -910,10 +910,26 @@ windows = ($cxx.target.class == 'windows')
$build 'configure:' prj/@prj-cfg/,forward &prj/build/bootstrap/*** 2>!;
- $* --no-progress --forward 2>>~%EOE%
+ $* --no-progress --forward 2>>~%EOE%;
%CI request is queued.*%
%reference: .+%
EOE
+
+ # While at it, test specifying a package name on the command line.
+ #
+ # Suppress the --yes option.
+ #
+ test.arguments = $regex.apply($test.arguments, '^--yes$', '');
+
+ $* --no-progress --forward prj <'y' 2>>~"%EOE%"
+ submitting:
+ to: $server
+ % in: $repository#non-standard-version@.{40}%
+ package: prj
+ version: 12345
+ %continue\\?.+ CI request is queued.*%
+ %reference: .+%
+ EOE
}
}
@@ -954,6 +970,27 @@ windows = ($cxx.target.class == 'windows')
EOE
}
+ : pkg-by-name
+ :
+ {
+ $clone_prj;
+ $init -C @cfg &prj-cfg/***;
+
+ # Suppress the --yes option.
+ #
+ test.arguments = $regex.apply($test.arguments, '^--yes$', '');
+
+ $* libprj <'y' 2>>~"%EOE%"
+ submitting:
+ to: $server
+ % in: $repository#master@.{40}%
+ package: libprj
+ version: 1.0.1
+ %continue\\?.+ CI request is queued.*%
+ %reference: .+%
+ EOE
+ }
+
: diff-configs
:
{
@@ -1009,7 +1046,7 @@ windows = ($cxx.target.class == 'windows')
# Suppress the --yes option.
#
- test.arguments = $regex.apply($test.arguments, '^(--yes)$', '');
+ test.arguments = $regex.apply($test.arguments, '^--yes$', '');
$* <'y' 2>>~"%EOE%"
submitting:
diff --git a/tests/publish.testscript b/tests/publish.testscript
index 41b5eed..688859d 100644
--- a/tests/publish.testscript
+++ b/tests/publish.testscript
@@ -33,7 +33,7 @@ g = [cmdline] 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.22
+# Next version to use: 1.0.25
#
# Normally we disable the progress indication that complicates stderr output
@@ -136,17 +136,39 @@ g = [cmdline] git -C prj >! 2>!
:
{
$new --no-init --no-amalgamation prj 2>- &prj/***;
- sed -i -e 's/^(version:) .*$/\1 12345/' prj/manifest;
+ sed -i -e 's/^(version:) .*$/\1 1.0.22/' prj/manifest;
sed -i \
- -e 's/^(amalgamation =.*)$/\1\nversion = 12345\ndist.package = $project-$version/' \
+ -e 's/^(amalgamation =.*)$/\1\nversion = 1.0.22\ndist.package = $project-$version/' \
-e 's/^using version$//' \
prj/build/bootstrap.build;
$build 'configure:' prj/@prj-cfg/,forward &prj/build/bootstrap/*** 2>!;
- $* --no-progress --forward --section alpha 2>>~%EOE%
- %package submission is queued(: .*prj/12345)?%
+ $* --no-progress --forward --section alpha 2>>~%EOE%;
+ %package submission is queued(: .*prj/1.0.22)?%
+ %reference: .{12}%
+ EOE
+
+ # While at it, test specifying a package name on the command line.
+ #
+ sed -i -e 's/^(version:) .*$/\1 1.0.23/' prj/manifest;
+ sed -i -e 's/^(version =) .*$/\1 1.0.23/' prj/build/bootstrap.build;
+
+ # Suppress the --yes option.
+ #
+ test.arguments = $regex.apply($test.arguments, '^--yes$', '');
+
+ $* --no-progress --forward --section alpha prj <'y' 2>>~"%EOE%"
+ publishing:
+ % to: $repository%
+ as: user <user@example.com>
+ package: prj
+ version: 1.0.23
+ project: prj
+ section: alpha
+ %.?
+ %continue\\?.+ package submission is queued.+%
%reference: .{12}%
EOE
}
@@ -178,6 +200,32 @@ g = [cmdline] git -C prj >! 2>!
EOE
}
+ : pkg-by-name
+ :
+ {
+ $clone_prj;
+ sed -i -e 's/^(version:) .*$/\1 1.0.24/' prj/libprj/manifest;
+ sed -i -e 's/^(version:) .*$/\1 1.0.24/' prj/prj/manifest;
+ $init -C @cfg &prj-cfg/***;
+
+ # Suppress the --yes option.
+ #
+ test.arguments = $regex.apply($test.arguments, '^--yes$', '');
+
+ $* libprj <'y' 2>>~"%EOE%"
+ publishing:
+ % to: $repository%
+ as: user <user@example.com>
+ package: libprj
+ version: 1.0.24
+ project: prj
+ section: stable
+ %.?
+ %continue\\?.+ package submission is queued.+%
+ %reference: .{12}%
+ EOE
+ }
+
: diff-configs
:
{
@@ -241,7 +289,7 @@ g = [cmdline] git -C prj >! 2>!
# Suppress the --yes option.
#
- test.arguments = $regex.apply($test.arguments, '^(--yes)$', '');
+ test.arguments = $regex.apply($test.arguments, '^--yes$', '');
$* <'y' 2>>~"%EOE%"
publishing:
diff --git a/tests/status.testscript b/tests/status.testscript
index 10480ac..c32ea88 100644
--- a/tests/status.testscript
+++ b/tests/status.testscript
@@ -102,8 +102,8 @@ config += -d prj 2>!
]
EOO
- $* libbar 2>>EOE;
- info: no packages initialized in configuration @cfg, skipping
+ $* libbar 2>>/"EOE" != 0;
+ error: no packages in project $~/prj/
EOE
$* --stdout-format 'json' libbar >>~%EOO%
@@ -323,3 +323,178 @@ config += -d prj 2>!
drop libprj
EOE
}
+
+: pkg-by-name
+:
+{
+ $new -t empty prj &prj/***;
+
+ $new --package pkg1 -d prj;
+ $new --package pkg2 -d prj;
+
+ $init -C @cfg $config_cxx -d prj/pkg1 &prj-cfg/***;
+
+ $new -t lib libprj &libprj/***;
+
+ cat <<EOI >+prj/repositories.manifest;
+ :
+ role: prerequisite
+ location: ../libprj
+ type: dir
+ EOI
+
+ cat <<EOI >+prj/pkg1/manifest;
+ depends: libprj
+ EOI
+
+ $sync;
+
+ # Initialized package is specified.
+ #
+ $* -d prj/pkg1 >>EOO;
+ pkg1 configured 0.1.0-a.0.19700101000000#1
+ EOO
+
+ $* pkg1 --stdout-format 'json' >>~%EOO%;
+ [
+ {
+ "configuration": {
+ "id": 1,
+ % "path": ".+prj-cfg",%
+ "name": "cfg"
+ },
+ "packages": [
+ {
+ "name": "pkg1",
+ "status": "configured",
+ "version": "0.1.0-a.0.19700101000000#1",
+ "hold_package": true,
+ "hold_version": true
+ }
+ ]
+ }
+ ]
+ EOO
+
+ # Not initialized package is specified.
+ #
+ $* pkg2 >>EOO;
+ pkg2 available 0.1.0-a.0.19700101000000
+ EOO
+
+ $* pkg2 --stdout-format 'json' >>~%EOO%;
+ [
+ {
+ "configuration": {
+ "id": 1,
+ % "path": ".+prj-cfg",%
+ "name": "cfg"
+ },
+ "packages": [
+ {
+ "name": "pkg2",
+ "status": "available",
+ "available_versions": [
+ {
+ "version": "0.1.0-a.0.19700101000000"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ EOO
+
+ # Dependency package is specified.
+ #
+ $* libprj >>EOO;
+ libprj configured 0.1.0-a.0.19700101000000
+ EOO
+
+ $* libprj --stdout-format 'json' >>~%EOO%;
+ [
+ {
+ "configuration": {
+ "id": 1,
+ % "path": ".+prj-cfg",%
+ "name": "cfg"
+ },
+ "packages": [
+ {
+ "name": "libprj",
+ "status": "configured",
+ "version": "0.1.0-a.0.19700101000000"
+ }
+ ]
+ }
+ ]
+ EOO
+
+ # Unknown dependency package is specified.
+ #
+ $* libprj1 >>EOO;
+ libprj1 unknown
+ EOO
+
+ $* libprj1 --stdout-format 'json' >>~%EOO%;
+ [
+ {
+ "configuration": {
+ "id": 1,
+ % "path": ".+prj-cfg",%
+ "name": "cfg"
+ },
+ "packages": [
+ {
+ "name": "libprj1",
+ "status": "unknown"
+ }
+ ]
+ }
+ ]
+ EOO
+
+ # No packages are specified.
+ #
+ $* >>EOO;
+ pkg1 configured 0.1.0-a.0.19700101000000#1
+ EOO
+
+ $* --stdout-format 'json' >>~%EOO%;
+ [
+ {
+ "configuration": {
+ "id": 1,
+ % "path": ".+prj-cfg",%
+ "name": "cfg"
+ },
+ "packages": [
+ {
+ "name": "pkg1",
+ "status": "configured",
+ "version": "0.1.0-a.0.19700101000000#1",
+ "hold_package": true,
+ "hold_version": true
+ },
+ {
+ "name": "pkg2",
+ "status": "uninitialized"
+ }
+ ]
+ }
+ ]
+ EOO
+
+ # Both initialized and dependency packages are specified.
+ #
+ $* libprj pkg1 -d prj 2>>EOE != 0;
+ error: initialized package pkg1 specified with dependency package libprj
+ EOE
+
+ $deinit 2>>/"EOE"
+ deinitializing in project $~/prj/
+ synchronizing:
+ drop pkg1
+ drop libprj
+ EOE
+}
diff --git a/tests/sync.testscript b/tests/sync.testscript
index 9f3e381..253e026 100644
--- a/tests/sync.testscript
+++ b/tests/sync.testscript
@@ -205,6 +205,67 @@ deinit += -d prj
EOE
}
+: pkg-by-name
+:
+{
+ $new -t empty prj &prj/***;
+
+ $new --package pkg1 -d prj;
+ $new --package pkg2 -d prj;
+
+ init += -d prj;
+
+ $init -C @cfg $config_cxx &prj-cfg/***;
+
+ $new -t lib libprj &libprj/***;
+
+ cat <<EOI >+prj/repositories.manifest;
+ :
+ role: prerequisite
+ location: ../libprj
+ type: dir
+ EOI
+
+ cat <<EOI >+prj/pkg1/manifest;
+ depends: libprj
+ EOI
+
+ cat <<EOI >+prj/pkg2/manifest;
+ tags: c++
+ EOI
+
+ $* pkg1 -d prj/pkg2 ?libprj 2>>~%EOE%;
+ %.+
+ synchronizing:
+ new libprj/0.1.0-a.0.19700101000000 (required by pkg1)
+ upgrade pkg1/0.1.0-a.0.19700101000000#1
+ upgrade pkg2/0.1.0-a.0.19700101000000#1
+ EOE
+
+ sed -i -e 's/^(version:).+$/\1 1.0.0/' libprj/manifest;
+
+ $* libprj -f -d prj 2>>~%EOE%;
+ %.+
+ synchronizing:
+ upgrade libprj/1.0.0
+ reconfigure pkg1/0.1.0-a.0.19700101000000#1
+ EOE
+
+ $* libprj pkg1 -d prj 2>>EOE != 0;
+ error: initialized package pkg1 specified with dependency package libprj
+ EOE
+
+ $deinit 2>>/"EOE"
+ deinitializing in project $~/prj/
+ deinitializing package pkg1
+ deinitializing package pkg2
+ synchronizing:
+ drop pkg1
+ drop libprj
+ drop pkg2
+ EOE
+}
+
: config-vars
:
{
diff --git a/tests/update.testscript b/tests/update.testscript
index 528a12b..a5689b6 100644
--- a/tests/update.testscript
+++ b/tests/update.testscript
@@ -135,3 +135,45 @@ deinit += -d prj
drop pkg1
EOE
}
+
+: pkg-by-name
+:
+{
+ $new -t empty prj &prj/***;
+
+ $new --package pkg1 -d prj;
+ $new --package pkg2 -d prj;
+
+ $init -C @cfg &prj-cfg/***;
+
+ $* pkg3 -d prj/ 2>>/"EOE" != 0;
+ error: no package pkg3 in project $~/prj/
+ EOE
+
+ $* pkg1 -d prj/pkg2 2>>~%EOE%;
+ %(mkdir|c\+\+|ld|ln) .+%{8}
+ EOE
+
+ # @@ TMP Strangely, get re-symlinked on Windows (every time if run this
+ # command multiple times).
+ #
+ $* pkg1 -d prj/ 2>>~%EOE%;
+ %ln .+pkg1.+ -> .+pkg1.+%?
+ %info: .+pkg1.+ is up to date%
+ EOE
+
+ $deinit pkg3 -d prj 2>>/"EOE" != 0;
+ error: no package pkg3 in project $~/prj/
+ EOE
+
+ # While at it, test specifying a package name on the deinit command line.
+ #
+ $deinit pkg1 -d prj/pkg2 2>>/"EOE"
+ deinitializing in project $~/prj/
+ deinitializing package pkg1
+ deinitializing package pkg2
+ synchronizing:
+ drop pkg1
+ drop pkg2
+ EOE
+}