From 9403537150bd2d4e7befb1b40fb61ea8db0ed751 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 7 Jul 2022 20:34:49 +0300 Subject: Use [cmdline] type for canned commands in testscripts --- tests/ci.testscript | 2 +- tests/common.testscript | 24 ++++++++++++------------ tests/new.testscript | 2 +- tests/project.testscript | 4 ++-- tests/publish.testscript | 12 ++++++------ tests/release.testscript | 30 +++++++++++++++--------------- 6 files changed, 37 insertions(+), 37 deletions(-) diff --git a/tests/ci.testscript b/tests/ci.testscript index f048de0..16d0834 100644 --- a/tests/ci.testscript +++ b/tests/ci.testscript @@ -26,7 +26,7 @@ end # +sed -i -e 's/^(version:) .*$/\1 1.0.1/' prj/manifest -g = git -C prj 2>! >&2 +g = [cmdline] git -C prj 2>! >&2 +$g config user.name 'Test Script' +$g config user.email 'testscript@example.com' diff --git a/tests/common.testscript b/tests/common.testscript index c4adca8..d0dd942 100644 --- a/tests/common.testscript +++ b/tests/common.testscript @@ -31,7 +31,7 @@ test.options += --default-options $options_guard \ --bpkg-option "--default-options=$options_guard" \ --bpkg-option "--build-option=--default-options=$options_guard" -build = $build --default-options $options_guard +build = [cmdline] $build --default-options $options_guard +cat <<"EOI" >=$options_guard/bdep-sync-implicit.options --build-option "--default-options=$options_guard" @@ -67,17 +67,17 @@ end # (for example, to make sure that configuration post-test state is valid and is # as expected). # -clean = $* clean -deinit = $* deinit -init = $* init -fetch = $* fetch -new = $* new --no-checks -status = $* status -sync = $* sync -update = $* update -config = $* config -publish = $* publish -release = $* release +clean = [cmdline] $* clean +deinit = [cmdline] $* deinit +init = [cmdline] $* init +fetch = [cmdline] $* fetch +new = [cmdline] $* new --no-checks +status = [cmdline] $* status +sync = [cmdline] $* sync +update = [cmdline] $* update +config = [cmdline] $* config +publish = [cmdline] $* publish +release = [cmdline] $* release # All testscripts are named after bdep commands, for example sync.testscript. # So the testscript scope id is a name of the command being tested. diff --git a/tests/new.testscript b/tests/new.testscript index 727f338..711ef24 100644 --- a/tests/new.testscript +++ b/tests/new.testscript @@ -1580,7 +1580,7 @@ status += -d prj : Here we smoke test the common source code layouts listed in bdep-new(1). : { - t = $build test: + t = [cmdline] $build test: : subdir : diff --git a/tests/project.testscript b/tests/project.testscript index efb0f2c..b40f7da 100644 --- a/tests/project.testscript +++ b/tests/project.testscript @@ -14,11 +14,11 @@ # The most commonly used project cloning command that copies it from the # parent scope working directory. # -clone_prj = cp -pr ../prj ./ +clone_prj = [cmdline] cp -pr ../prj ./ # Clones the original project from the root scope working directory. # -clone_root_prj = cp -pr $~/prj ./ +clone_root_prj = [cmdline] cp -pr $~/prj ./ # Setup a test command to use a cloned project directory by default. # diff --git a/tests/publish.testscript b/tests/publish.testscript index add8418..08e00fe 100644 --- a/tests/publish.testscript +++ b/tests/publish.testscript @@ -27,7 +27,7 @@ init += $config_cxx -d prj 2>! &prj/**/bootstrap/*** windows = ($cxx.target.class == 'windows') -g = git -C prj >! 2>! +g = [cmdline] 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, @@ -272,7 +272,7 @@ g = git -C prj >! 2>! test.options += --no-progress test.arguments += --simulate 'success' - clone_prj = cp --no-cleanup -pr ../prj ./ &prj/*** + clone_prj = [cmdline] cp --no-cleanup -pr ../prj ./ &prj/*** +$clone_prj @@ -350,7 +350,7 @@ g = git -C prj >! 2>! test.options += --no-progress test.arguments += --simulate 'success' - clone_prj = cp --no-cleanup -pr ../prj ./ &prj/***; + clone_prj = [cmdline] cp --no-cleanup -pr ../prj ./ &prj/***; $clone_prj; rm -rf prj/.git; @@ -445,8 +445,8 @@ g = git -C prj >! 2>! +$g config user.name 'Test Script' +$g config user.email 'testscript@example.com' - clone_rep = cp --no-cleanup -r ../prj.git ./ &prj.git/*** - clone_prj = cp --no-cleanup -r ../prj ./ &prj/*** + clone_rep = [cmdline] cp --no-cleanup -r ../prj.git ./ &prj.git/*** + clone_prj = [cmdline] cp --no-cleanup -r ../prj ./ &prj/*** : success : @@ -526,7 +526,7 @@ g = git -C prj >! 2>! : failure : { - g2 = git -C prj2 >! 2>! + g2 = [cmdline] git -C prj2 >! 2>! # Setup the remote repository. # diff --git a/tests/release.testscript b/tests/release.testscript index 0b772c1..f626de7 100644 --- a/tests/release.testscript +++ b/tests/release.testscript @@ -11,23 +11,23 @@ exit end -g = git 2>! >&2 +g = [cmdline] git 2>! >&2 # Create the remote repository. # +mkdir --no-cleanup prj.git +$g -C prj.git init --bare &prj.git/*** -clone_rep = cp --no-cleanup -pr ../prj.git ./ &prj.git/*** -clone_root_rep = cp --no-cleanup -pr $~/prj.git ./ &prj.git/*** +clone_rep = [cmdline] cp --no-cleanup -pr ../prj.git ./ &prj.git/*** +clone_root_rep = [cmdline] cp --no-cleanup -pr $~/prj.git ./ &prj.git/*** # Prepare the local repository. # # Set the origin repository location as a relative path, so we can copy the # local/remote repository pair into the testscript scopes. # -gp = $g -C prj -log = $gp log '--pretty=format:"%d %s"' +gp = [cmdline] $g -C prj +log = [cmdline] $gp log '--pretty=format:"%d %s"' +$gp config user.name 'Test Script' +$gp config user.email 'testscript@example.com' @@ -36,11 +36,11 @@ log = $gp log '--pretty=format:"%d %s"' +$gp commit -m 'Create' --no-verify +$gp push --set-upstream origin master -clone_prj = cp --no-cleanup -pr ../prj ./ &prj/*** -clone_root_prj = cp --no-cleanup -pr $~/prj ./ &prj/*** +clone_prj = [cmdline] cp --no-cleanup -pr ../prj ./ &prj/*** +clone_root_prj = [cmdline] cp --no-cleanup -pr $~/prj ./ &prj/*** -clone_repos = $clone_prj && $clone_rep -clone_root_repos = $clone_root_prj && $clone_root_rep +clone_repos = [cmdline] $clone_prj && $clone_rep +clone_root_repos = [cmdline] $clone_root_prj && $clone_root_rep release += 2>! @@ -48,11 +48,11 @@ release += 2>! # the result of the release operation(s), that is normally pushed to the # remote repository. # -gp2 = $g -C prj2 -clone2 = $g clone prj.git prj2 &prj2/*** -pull2 = $gp2 pull --ff-only -fetch2 = $gp2 fetch -log2 = $gp2 log '--pretty=format:"%d %s"' +gp2 = [cmdline] $g -C prj2 +clone2 = [cmdline] $g clone prj.git prj2 &prj2/*** +pull2 = [cmdline] $gp2 pull --ff-only +fetch2 = [cmdline] $gp2 fetch +log2 = [cmdline] $gp2 log '--pretty=format:"%d %s"' : single-pkg : @@ -705,7 +705,7 @@ log2 = $gp2 log '--pretty=format:"%d %s"' Create EOO - tag = $release --tag --push -q --yes -d prj + tag = [cmdline] $release --tag --push -q --yes -d prj : update : -- cgit v1.1