diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/publish.testscript | 156 | ||||
-rw-r--r-- | tests/release.testscript | 418 |
2 files changed, 419 insertions, 155 deletions
diff --git a/tests/publish.testscript b/tests/publish.testscript index 7913272..df3a817 100644 --- a/tests/publish.testscript +++ b/tests/publish.testscript @@ -37,21 +37,25 @@ init += $cxx -d prj 2>! &prj/**/bootstrap/*** windows = ($cxx.target.class == 'windows') +g = git -C prj >! 2>! + # Note that using the same package name and version for tests may result in # duplicate submissions. We will use unique version for each test, # incrementing the patch version for 1.0.X. # -# Next version to use: 1.0.15 +# Next version to use: 1.0.19 # : submit : { test.arguments += --control 'none' + +$clone_prj + : single-pkg : { - test.arguments += --simulate 'success' + test.arguments += --force=uncommitted --simulate 'success' : single-cfg : @@ -65,7 +69,7 @@ windows = ($cxx.target.class == 'windows') upgrade prj/1.0.1 submitting prj-1.0.1.tar.gz %.* - %package submission is queued(: .*prj/1\.0\.1)?% + %package submission is queued(: \.*prj/1.0.1)?%d %reference: .{12}% EOE } @@ -90,12 +94,30 @@ windows = ($cxx.target.class == 'windows') $* --all 2>'error: multiple configurations specified for publish' != 0 } + + : snapshot + : + { + $clone_root_prj; + $init -C @cfg &prj-cfg/***; + sed -i -e 's/^(version:) .*$/\1 1.0.15-a.0.z/' prj/manifest; + + $* 2>>EOE != 0; + synchronizing: + upgrade prj/1.0.15-a.0.19700101000000 + error: package prj version 1.0.15-a.0.19700101000000 is a snapshot + EOE + + $* --force=snapshot 2>>~%EOE% != 0 + error: package prj version 1.0.15-a.0.19700101000000 is a snapshot + EOE + } } : multi-pkg : { - test.arguments += --simulate 'success' + test.arguments += --force=uncommitted --simulate 'success' +$new -t empty prj &prj/*** +$new --package -t lib libprj -d prj @@ -112,11 +134,11 @@ windows = ($cxx.target.class == 'windows') $* 2>>~%EOE% submitting libprj-1.0.2.tar.gz %.* - %package submission is queued(: .*libprj/1\.0\.2)?% + %package submission is queued(: \.*libprj/1.0.2)?%d %reference: .{12}% submitting prj-1.0.2.tar.gz %.* - %package submission is queued(: .*prj/1\.0\.2)?% + %package submission is queued(: \.*prj/1.0.2)?%d %reference: .{12}% EOE } @@ -135,7 +157,7 @@ windows = ($cxx.target.class == 'windows') $* 2>>~%EOE% submitting libprj-1.0.3.tar.gz %.* - %package submission is queued(: .*prj/1\.0\.3)?% + %package submission is queued(: \.*prj/1.0.3)?%d %reference: .{12}% EOE } @@ -169,19 +191,118 @@ windows = ($cxx.target.class == 'windows') %warning: publishing using staged build2 toolchain%? continue? [y/n] submitting libprj-1.0.4.tar.gz %.* - %package submission is queued\(: .*libprj/1\\.0\\.4\)?% + %package submission is queued\(: \\.*libprj/1.0.4\)?%d %reference: .{12}% submitting prj-1.0.4.tar.gz %.* - %package submission is queued\(: .*prj/1\\.0\\.4\)?% + %package submission is queued\(: \\.*prj/1.0.4\)?%d %reference: .{12}% EOE } } + : commited-prj + : + { + test.arguments += --simulate 'success' + + clone_prj = cp --no-cleanup -p -r ../prj ./ &prj/*** + + +$clone_prj + + +$g config user.name 'Test Script' + +$g config user.email 'testscript@example.com' + +$g add '*' + +$g commit -m 'Create' + + : final + : + { + $clone_prj; + $init -C @cfg &prj-cfg/***; + sed -i -e 's/^(version:) .*$/\1 1.0.16/' prj/manifest; + + $* 2>>~%EOE% != 0; + synchronizing: + upgrade prj/1.0.16 + error: project directory has uncommitted changes + info: run 'git status' for details + info: use 'git stash' to temporarily hide the changes + info: use --force=uncommitted to publish anyway + EOE + + $g commit -a -m 'Version'; + + $* 2>>~%EOE% + submitting prj-1.0.16.tar.gz + %.* + %package submission is queued(: \.*prj/1.0.16)?%d + %reference: .{12}% + EOE + } + + : snapshot + : + { + $clone_prj; + $init -C @cfg &prj-cfg/***; + sed -i -e 's/^(version:) .*$/\1 1.0.17-a.0.z/' prj/manifest; + + $* 2>>~%EOE% != 0; + synchronizing: + % upgrade prj/1.0.17-a.0.\.+%d + error: project directory has uncommitted changes + info: run 'git status' for details + info: use 'git stash' to temporarily hide the changes + info: use --force=uncommitted to publish anyway + EOE + + $g commit -a -m 'Version'; + + $* 2>>~%EOE% != 0; + synchronizing: + % upgrade prj/1.0.17-a.0.\.+%d + %error: package prj version 1.0.17-a.0.\.+ is a snapshot%d + info: use --force=snapshot to publish anyway + EOE + + $* --force=snapshot 2>>~%EOE% + %submitting prj-1.0.17-a.0.\.+.tar.gz%d + %.* + %package submission is queued(: \.*prj/1.0.17-a.0.\.+)?%d + %reference: .{12}% + EOE + } + } + + : non-vsc-prj + : + { + test.arguments += --simulate 'success' + + clone_prj = cp --no-cleanup -p -r ../prj ./ &prj/***; + + $clone_prj; + rm -r -f prj/.git; + + $init -C @cfg &prj-cfg/***; + sed -i -e 's/^(version:) .*$/\1 1.0.18/' prj/manifest; + + $* 2>>~%EOE% + synchronizing: + upgrade prj/1.0.18 + submitting prj-1.0.18.tar.gz + %.* + %package submission is queued(: \.*prj/1.0.18)?%d + %reference: .{12}% + EOE + } + : failure : { + test.arguments += --force=uncommitted + : duplicate-archive : { @@ -248,7 +369,8 @@ windows = ($cxx.target.class == 'windows') # simulation. We specify it to enable the control branch-related # functionality. # - test.arguments += --simulate 'success' --control 'http://example.com/rep.git' + test.arguments += --force=uncommitted --simulate 'success' \ +--control 'http://example.com/rep.git' # Create the remote repository. # @@ -257,8 +379,6 @@ windows = ($cxx.target.class == 'windows') +$clone_prj - g = git -C prj >! 2>! - +$g config user.name 'Test Script' +$g config user.email 'testscript@example.com' @@ -291,7 +411,7 @@ windows = ($cxx.target.class == 'windows') %.* submitting prj-1.0.8.tar.gz %.* - %package submission is queued(: .*prj/1\.0\.8)?% + %package submission is queued(: \.*prj/1.0.8)?%d %reference: .{12}% EOE @@ -307,7 +427,7 @@ windows = ($cxx.target.class == 'windows') %.* submitting prj-1.0.9.tar.gz %.* - %package submission is queued(: .*prj/1\.0\.9)?% + %package submission is queued(: \.*prj/1.0.9)?%d %reference: .{12}% EOE @@ -325,7 +445,7 @@ windows = ($cxx.target.class == 'windows') %.* submitting prj-1.0.10.tar.gz %.* - %package submission is queued(: .*prj/1\.0\.10)?% + %package submission is queued(: \.*prj/1.0.10)?%d %reference: .{12}% EOE @@ -407,7 +527,7 @@ windows = ($cxx.target.class == 'windows') %.* submitting prj-1.0.12.tar.gz %.* - %package submission is queued(: .*prj/1\.0\.12)?% + %package submission is queued(: \.*prj/1.0.12)?%d %reference: .{12}% EOE @@ -425,7 +545,7 @@ windows = ($cxx.target.class == 'windows') %.* submitting prj-1.0.13.tar.gz %.* - %package submission is queued(: .*prj/1\.0\.13)?% + %package submission is queued(: \.*prj/1.0.13)?%d %reference: .{12}% EOE @@ -466,7 +586,7 @@ windows = ($cxx.target.class == 'windows') %.* submitting prj-1.0.14.tar.gz %.* - %package submission is queued(: .*prj/1\.0\.14)?% + %package submission is queued(: \.*prj/1.0.14)?%d %reference: .{12}% EOE diff --git a/tests/release.testscript b/tests/release.testscript index 98fddad..45d6867 100644 --- a/tests/release.testscript +++ b/tests/release.testscript @@ -61,94 +61,100 @@ log2 = $gp2 log '--pretty=format:"%d %s"' : release : { - test.arguments += --push - - : patch + : version : { - $clone_root_repos; + test.arguments += --push - $*; + : patch + : + { + $clone_root_repos; - $clone2; - $log2 >>:~%EOO%; - % \(HEAD -> master, \.*\) Change version to 0.2.0-a.0.z%d - (tag: v0.1.0) Release version 0.1.0 - Create - EOO + $*; - cat prj2/manifest >>~%EOO% - %.* - name: prj - version: 0.2.0-a.0.z - summary: prj executable - %.* + $clone2; + $log2 >>:~%EOO%; + % \(HEAD -> master, \.*\) Change version to 0.2.0-a.0.z%d + (tag: v0.1.0) Release version 0.1.0 + Create EOO - } - : alpha - : - { - $clone_root_repos; + cat prj2/manifest >>~%EOO% + %.* + name: prj + version: 0.2.0-a.0.z + summary: prj executable + %.* + EOO + } - $* --alpha; + : alpha + : + { + $clone_root_repos; - $clone2; - $log2 >>:~%EOO% - % \(HEAD -> master, \.*\) Change version to 0.1.0-a.1.z%d - (tag: v0.1.0-a.1) Release version 0.1.0-a.1 - Create - EOO - } + $* --alpha; - : beta - : - { - $clone_root_repos; + $clone2; + $log2 >>:~%EOO% + % \(HEAD -> master, \.*\) Change version to 0.1.0-a.1.z%d + (tag: v0.1.0-a.1) Release version 0.1.0-a.1 + Create + EOO + } - $* --beta; + : beta + : + { + $clone_root_repos; - $clone2; - $log2 >>:~%EOO% - % \(HEAD -> master, \.*\) Change version to 0.1.0-b.1.z%d - (tag: v0.1.0-b.1) Release version 0.1.0-b.1 - Create - EOO - } + $* --beta; - : minor - : - { - $clone_root_repos; + $clone2; + $log2 >>:~%EOO% + % \(HEAD -> master, \.*\) Change version to 0.1.0-b.1.z%d + (tag: v0.1.0-b.1) Release version 0.1.0-b.1 + Create + EOO + } - $* --minor; + : minor + : + { + $clone_root_repos; - $clone2; - $log2 >>:~%EOO% - % \(HEAD -> master, \.*\) Change version to 0.3.0-a.0.z%d - (tag: v0.2.0) Release version 0.2.0 - Create - EOO - } + $* --minor; - : major - : - { - $clone_root_repos; + $clone2; + $log2 >>:~%EOO% + % \(HEAD -> master, \.*\) Change version to 0.3.0-a.0.z%d + (tag: v0.2.0) Release version 0.2.0 + Create + EOO + } - $* --major; + : major + : + { + $clone_root_repos; - $clone2; - $log2 >>:~%EOO% - % \(HEAD -> master, \.*\) Change version to 1.1.0-a.0.z%d - (tag: v1.0.0) Release version 1.0.0 - Create - EOO + $* --major; + + $clone2; + $log2 >>:~%EOO% + % \(HEAD -> master, \.*\) Change version to 1.1.0-a.0.z%d + (tag: v1.0.0) Release version 1.0.0 + Create + EOO + } } : open : { + test.arguments += --push + : beta : { @@ -243,87 +249,107 @@ log2 = $gp2 log '--pretty=format:"%d %s"' } } - : no-open + : no : { - $clone_root_repos; + test.arguments += --push - $* --no-open; + : open + : + { + $clone_root_repos; - $clone2; - $log2 >>:~%EOO%; - % \(HEAD -> master, tag: v0.1.0, \.*\) Release version 0.1.0%d - Create - EOO + $* --no-open; - $* --open; + $clone2; + $log2 >>:~%EOO%; + % \(HEAD -> master, tag: v0.1.0, \.*\) Release version 0.1.0%d + Create + EOO - $pull2; - $log2 >>:~%EOO% - % \(HEAD -> master, \.*\) Change version to 0.2.0-a.0.z%d - (tag: v0.1.0) Release version 0.1.0 - Create - EOO - } + $* --open; - : no-tag - : - { - $clone_root_repos; + $pull2; + $log2 >>:~%EOO% + % \(HEAD -> master, \.*\) Change version to 0.2.0-a.0.z%d + (tag: v0.1.0) Release version 0.1.0 + Create + EOO + } - $* --no-tag; + : tag + : + { + $clone_root_repos; - $clone2; - $log2 >>:~%EOO%; - % \(HEAD -> master, \.*\) Change version to 0.2.0-a.0.z%d - Release version 0.1.0 - Create - EOO + $* --no-tag; - $* --tag 2>'error: current version 0.2.0-a.0.z is a snapshot' != 0 - } + $clone2; + $log2 >>:~%EOO%; + % \(HEAD -> master, \.*\) Change version to 0.2.0-a.0.z%d + Release version 0.1.0 + Create + EOO - : no-tag-no-open - : - { - $clone_root_repos; + $* --tag 2>>EOE != 0; + error: current version 0.2.0-a.0.z is a snapshot + info: use --force=snapshot to tag anyway + EOE - $* --no-tag --no-open; + $* --tag --force=snapshot; - $clone2; - $log2 >>:~%EOO%; - % \(HEAD -> master, \.*\) Release version 0.1.0%d - Create - EOO + $pull2; + $log2 >>:~%EOO% + % \(HEAD -> master, tag: v0.2.0-a.0.\.*.\.*\) Change version to 0.2.0-a.0.z%d + Release version 0.1.0 + Create + EOO + } - $* --tag; + : tag-open + : + { + $clone_root_repos; - $pull2; - $log2 >>:~%EOO%; - % \(HEAD -> master, tag: v0.1.0, \.*\) Release version 0.1.0%d - Create - EOO + $* --no-tag --no-open; - $* --open; + $clone2; + $log2 >>:~%EOO%; + % \(HEAD -> master, \.*\) Release version 0.1.0%d + Create + EOO - $pull2; - $log2 >>:~%EOO% - % \(HEAD -> master, \.*\) Change version to 0.2.0-a.0.z%d - (tag: v0.1.0) Release version 0.1.0 - Create - EOO - } + $* --tag; - : no-commit - : - { - $clone_root_repos; + $pull2; + $log2 >>:~%EOO%; + % \(HEAD -> master, tag: v0.1.0, \.*\) Release version 0.1.0%d + Create + EOO + + $* --open; + + $pull2; + $log2 >>:~%EOO% + % \(HEAD -> master, \.*\) Change version to 0.2.0-a.0.z%d + (tag: v0.1.0) Release version 0.1.0 + Create + EOO + } + + : commit + : + { + $clone_root_repos; - $* --no-commit 2>'error: both --push and --no-commit specified' != 0 + $* --no-commit 2>'error: both --push and --no-commit specified' != 0 + } } : validate-manifest { + test.arguments += --push + : file-value : { @@ -363,6 +389,31 @@ log2 = $gp2 log '--pretty=format:"%d %s"' EOE } } + + : unstaged + : + { + $clone_root_repos; + echo '' >+ prj/manifest; + + $* 2>>EOE != 0; + error: project directory has unstaged changes + info: run 'git status' for details + info: use 'git add' to add the changes to this commit + info: use 'git stash' to temporarily hide the changes + EOE + + $* --no-commit; + + $gp commit -a -m 'Release version'; + $* --tag --push; + + $clone2; + $log2 >>:~%EOO% + % \(HEAD -> master, tag: v0.1.0, \.*\) Release version%d + Create + EOO + } } : revision @@ -371,17 +422,74 @@ log2 = $gp2 log '--pretty=format:"%d %s"' +$clone_root_repos +$* --no-open --push - +echo '' >+ prj/manifest - +$gp add manifest + test.arguments += --revision - test.arguments += --revision --push + : changes-staged + : + { + test.arguments += --push - : default + +$clone_repos + + +echo '' >+ prj/manifest + +$gp add manifest + + : default + : + { + $clone_repos; + + $* 2>>~%EOE%; + %Updated tag 'v0.1.0' \(was \.*\)%d + EOE + + $clone2; + $log2 >>:~%EOO% + % \(HEAD -> master, tag: v0.1.0, \.*\) Release version 0.1.0\+1%d + Release version 0.1.0 + Create + EOO + } + + : no-tag + : + { + $clone_repos; + + $* --no-tag; + + $clone2; + $log2 >>:~%EOO%; + % \(HEAD -> master, \.*\) Release version 0.1.0\+1%d + (tag: v0.1.0) Release version 0.1.0 + Create + EOO + + $release --tag --push --yes -d prj; + + $pull2 --tags; # Updates the existing local tag. + $log2 >>:~%EOO% + % \(HEAD -> master, tag: v0.1.0, \.*\) Release version 0.1.0\+1%d + Release version 0.1.0 + Create + EOO + } + } + + : no-changes-staged : { + test.arguments += --push + $clone_repos; - $* 2>>~%EOE%; + $* 2>>~%EOE% != 0; + error: project directory has no staged changes + info: revision increment must be committed together with associated changes + info: use --force=unchanged to release anyway + EOE + + $* --force=unchanged 2>>~%EOE%; %Updated tag 'v0.1.0' \(was \.*\)%d EOE @@ -393,26 +501,62 @@ log2 = $gp2 log '--pretty=format:"%d %s"' EOO } - : no-tag + : unstaged : { $clone_repos; - $* --no-tag; + echo '' >+ prj/manifest; + + $* 2>>EOE != 0; + error: project directory has unstaged changes + info: run 'git status' for details + info: use 'git add' to add the changes to this commit + info: use 'git stash' to temporarily hide the changes + EOE + + $* --no-commit; + + $gp commit -a -m 'Release revision'; + $release --tag --push --yes -d prj; $clone2; - $log2 >>:~%EOO%; - % \(HEAD -> master, \.*\) Release version 0.1.0\+1%d - (tag: v0.1.0) Release version 0.1.0 + $log2 >>:~%EOO% + % \(HEAD -> master, tag: v0.1.0, \.*\) Release revision%d + Release version 0.1.0 Create EOO + } + } - $release --tag --push --yes -d prj; + : open + : + { + : unstaged + : + { + $clone_root_repos; + + $* --no-open; + + echo '' >+ prj/manifest; - $pull2 --tags; # Updates the existing local tag. + $* --open 2>>EOE != 0; + error: project directory has unstaged changes + info: run 'git status' for details + info: use 'git add' to add the changes to this commit + info: use 'git stash' to temporarily hide the changes + EOE + + $* --open --no-commit; + + $gp commit -a -m 'Open dev cycle'; + $gp push origin HEAD --tags; + + $clone2; $log2 >>:~%EOO% - % \(HEAD -> master, tag: v0.1.0, \.*\) Release version 0.1.0\+1%d - Release version 0.1.0 + % \(HEAD -> master, \.*\) Open dev cycle%d + (tag: v0.1.0) Release version 0.1.0 Create EOO } |