aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bdep/bdep.cxx3
-rw-r--r--bdep/ci.cxx2
-rw-r--r--bdep/common.cli17
-rw-r--r--bdep/git.cxx28
-rw-r--r--bdep/git.hxx19
-rw-r--r--bdep/git.txx105
-rw-r--r--bdep/http-service.cxx126
-rw-r--r--bdep/http-service.hxx2
-rw-r--r--bdep/publish.cxx73
-rw-r--r--bdep/release.cxx25
-rw-r--r--bdep/sync.cxx24
-rw-r--r--bdep/utility.cxx28
-rw-r--r--bdep/utility.hxx17
-rw-r--r--bdep/utility.txx19
-rw-r--r--tests/ci.testscript32
-rw-r--r--tests/publish.testscript91
-rw-r--r--tests/release.testscript134
17 files changed, 514 insertions, 231 deletions
diff --git a/bdep/bdep.cxx b/bdep/bdep.cxx
index 6e17a3f..00d70f7 100644
--- a/bdep/bdep.cxx
+++ b/bdep/bdep.cxx
@@ -36,6 +36,7 @@
#include <bdep/clean.hxx>
using namespace std;
+using namespace butl;
using namespace bdep;
namespace bdep
@@ -157,6 +158,8 @@ try
{
using namespace cli;
+ stderr_term = fdterm (stderr_fd ());
+
argv0 = argv[0];
exec_dir = path (argv0).directory ();
diff --git a/bdep/ci.cxx b/bdep/ci.cxx
index 304818d..08193b3 100644
--- a/bdep/ci.cxx
+++ b/bdep/ci.cxx
@@ -253,7 +253,7 @@ namespace bdep
{
// Print progress unless we had a prompt.
//
- if (verb && o.yes ())
+ if (verb && o.yes () && !o.no_progress ())
text << "submitting to " << srv;
url u (srv);
diff --git a/bdep/common.cli b/bdep/common.cli
index 4736159..2db2677 100644
--- a/bdep/common.cli
+++ b/bdep/common.cli
@@ -90,6 +90,23 @@ namespace bdep
system."
}
+ // When it comes to external programs (such as curl, git, etc), if stderr
+ // is not a terminal, the logic is actually tri-state: With --no-progress
+ // we suppress any progress. With --progress (which we may add in the
+ // future), we request full progress. Finally, without any --*progress
+ // options we let the external program decide what to do: it may do
+ // something intelligent (like curl) and produce non-terminal-friendly
+ // progress (such as status lines printed periodically) or it may disable
+ // progress all together (like git). Of course, it may also do no
+ // detection and dump non-terminal-unfriendly progress in which case we
+ // should probably do the detection ourselves and suppress it.
+ //
+ bool --no-progress
+ {
+ "Suppress progress indicators for long-lasting operations, such as
+ network transfers, building, etc."
+ }
+
path --bpkg
{
"<path>",
diff --git a/bdep/git.cxx b/bdep/git.cxx
index 311a557..91964aa 100644
--- a/bdep/git.cxx
+++ b/bdep/git.cxx
@@ -257,22 +257,24 @@ namespace bdep
// git-status --porcelain=2 (available since git 2.11.0) gives us all the
// information with a single invocation.
//
- process pr;
+ fdpipe pipe (open_pipe ()); // Text mode seems appropriate.
+
+ process pr (start_git (semantic_version {2, 11, 0},
+ repo,
+ 0 /* stdin */,
+ pipe /* stdout */,
+ 2 /* stderr */,
+ "status",
+ "--porcelain=2",
+ "--branch"));
+
+ // Shouldn't throw, unless something is severely damaged.
+ //
+ pipe.out.close ();
+
bool io (false);
try
{
- fdpipe pipe (fdopen_pipe ()); // Text mode seems appropriate.
-
- pr = start_git (semantic_version {2, 11, 0},
- repo,
- 0 /* stdin */,
- pipe /* stdout */,
- 2 /* stderr */,
- "status",
- "--porcelain=2",
- "--branch");
-
- pipe.out.close ();
ifdstream is (move (pipe.in), fdstream_mode::skip, ifdstream::badbit);
// Lines starting with '#' are headers (come first) with any other line
diff --git a/bdep/git.hxx b/bdep/git.hxx
index 9f968dd..e699947 100644
--- a/bdep/git.hxx
+++ b/bdep/git.hxx
@@ -9,6 +9,7 @@
#include <bdep/types.hxx>
#include <bdep/utility.hxx>
+#include <bdep/common-options.hxx>
namespace bdep
{
@@ -39,7 +40,17 @@ namespace bdep
//
template <typename... A>
void
- run_git (const semantic_version&, const dir_path& repo, A&&... args);
+ run_git (const semantic_version&,
+ bool progress,
+ const dir_path& repo,
+ A&&... args);
+
+ template <typename... A>
+ inline void
+ run_git (const semantic_version& min_ver, const dir_path& repo, A&&... args)
+ {
+ run_git (min_ver, true /* progress */, repo, forward<A> (args)...);
+ }
// Return the first line of the git output. If ignore_error is true, then
// suppress stderr, ignore (normal) error exit status, and return nullopt.
@@ -95,6 +106,12 @@ namespace bdep
//
git_repository_status
git_status (const dir_path& repo);
+
+ // Run the git push command.
+ //
+ template <typename... A>
+ void
+ git_push (const common_options&, const dir_path& repo, A&&... args);
}
#include <bdep/git.ixx>
diff --git a/bdep/git.txx b/bdep/git.txx
index 4624102..5ff5e6c 100644
--- a/bdep/git.txx
+++ b/bdep/git.txx
@@ -6,21 +6,69 @@ namespace bdep
{
template <typename... A>
void
- run_git (const semantic_version& min_ver, const dir_path& repo, A&&... args)
+ run_git (const semantic_version& min_ver,
+ bool progress,
+ const dir_path& repo,
+ A&&... args)
{
- // We don't expect git to print anything to stdout, as the caller would use
- // start_git() and pipe otherwise. Thus, let's redirect stdout to stderr
- // for good measure, as git is known to print some informational messages
- // to stdout.
+ // Unfortunately git doesn't have any kind of a no-progress option but
+ // suppresses progress automatically for a non-terminal. So we use this
+ // feature for the progress suppression by redirecting git's stderr to our
+ // own diagnostics stream via a proxy pipe.
+ //
+ fdpipe pipe;
+
+ if (!progress)
+ pipe = open_pipe ();
+
+ int err (!progress ? pipe.out.get () : 2);
+
+ // We don't expect git to print anything to stdout, as the caller would
+ // use start_git() and pipe otherwise. Thus, let's redirect stdout to
+ // stderr for good measure, as git is known to print some informational
+ // messages to stdout.
//
process pr (start_git (min_ver,
repo,
- 0 /* stdin */,
- 2 /* stdout */,
- 2 /* stderr */,
+ 0 /* stdin */,
+ err /* stdout */,
+ err /* stderr */,
forward<A> (args)...));
- finish_git (pr);
+ bool io (false);
+
+ if (!progress)
+ {
+ // Shouldn't throw, unless something is severely damaged.
+ //
+ pipe.out.close ();
+
+ try
+ {
+ ifdstream is (move (pipe.in), fdstream_mode::skip, ifdstream::badbit);
+
+ // We could probably write something like this, instead:
+ //
+ // *diag_stream << is.rdbuf () << flush;
+ //
+ // However, it would never throw and we could potentially miss the
+ // reading failure.
+ //
+ for (string l; !eof (getline (is, l)); )
+ *diag_stream << l << std::endl;
+
+ is.close ();
+ }
+ catch (const io_error&)
+ {
+ // Presumably the child process failed and issued diagnostics so let
+ // finish_git() try to deal with that.
+ //
+ io = true;
+ }
+ }
+
+ finish_git (pr, io);
}
void
@@ -43,8 +91,8 @@ namespace bdep
optional<string>
git_line (const semantic_version& min_ver, bool ie, A&&... args)
{
- fdpipe pipe (fdopen_pipe ());
- auto_fd null (ie ? fdnull () : auto_fd ());
+ fdpipe pipe (open_pipe ());
+ auto_fd null (ie ? open_dev_null () : auto_fd ());
process pr (start_git (min_ver,
0 /* stdin */,
@@ -54,4 +102,39 @@ namespace bdep
return git_line (move (pr), move (pipe), ie);
}
+
+ template <typename... A>
+ void
+ git_push (const common_options& o, const dir_path& repo, A&&... args)
+ {
+ // Map verbosity level. Suppress the (too detailed) push command output if
+ // the verbosity level is 1. However, we still want to see the progress in
+ // this case, unless we were asked to suppress it (git also suppress
+ // progress for a non-terminal stderr).
+ //
+ cstrings v;
+ bool progress (!o.no_progress ());
+
+ if (verb < 2)
+ {
+ v.push_back ("-q");
+
+ if (progress)
+ {
+ if (verb == 1 && stderr_term)
+ v.push_back ("--progress");
+ }
+ else
+ progress = true; // No need to suppress (already done with -q).
+ }
+ else if (verb > 3)
+ v.push_back ("-v");
+
+ run_git (semantic_version {2, 1, 0},
+ progress,
+ repo,
+ "push",
+ v,
+ forward<A> (args)...);
+ }
}
diff --git a/bdep/http-service.cxx b/bdep/http-service.cxx
index 59598c0..8b4f059 100644
--- a/bdep/http-service.cxx
+++ b/bdep/http-service.cxx
@@ -53,6 +53,52 @@ namespace bdep
//
optional<url> location;
+ // Map the verbosity level.
+ //
+ cstrings v;
+ bool progress (!o.no_progress ());
+
+ auto suppress_progress = [&v] ()
+ {
+ v.push_back ("-s");
+ v.push_back ("-S"); // But show errors.
+ };
+
+ if (verb < 1)
+ {
+ suppress_progress ();
+ progress = true; // No need to suppress (already done).
+ }
+ else if (verb == 1 && fdterm (2))
+ {
+ if (progress)
+ v.push_back ("--progress-bar");
+ }
+ else if (verb > 3)
+ v.push_back ("-v");
+
+ // Suppress progress.
+ //
+ // Note: the `-v -s` options combination is valid and results in a
+ // verbose output without progress.
+ //
+ if (!progress)
+ suppress_progress ();
+
+ // Convert the submit arguments to curl's --form* options.
+ //
+ strings fos;
+ for (const parameter& p: params)
+ {
+ fos.emplace_back (p.type == parameter::file
+ ? "--form"
+ : "--form-string");
+
+ fos.emplace_back (p.type == parameter::file
+ ? p.name + "=@" + p.value
+ : p.name + "=" + p.value);
+ }
+
// Note that it's a bad idea to issue the diagnostics while curl is
// running, as it will be messed up with the progress output. Thus, we
// throw the runtime_error exception on the HTTP response parsing error
@@ -63,65 +109,39 @@ namespace bdep
// running curl over using butl::curl because in this context it is
// restrictive and inconvenient.
//
- process pr;
- bool io (false);
- try
- {
- // Map the verbosity level.
- //
- cstrings v;
- if (verb < 1)
- {
- v.push_back ("-s");
- v.push_back ("-S"); // But show errors.
- }
- else if (verb == 1 && fdterm (2))
- v.push_back ("--progress-bar");
- else if (verb > 3)
- v.push_back ("-v");
-
- // Convert the submit arguments to curl's --form* options.
- //
- strings fos;
- for (const parameter& p: params)
- {
- fos.emplace_back (p.type == parameter::file
- ? "--form"
- : "--form-string");
-
- fos.emplace_back (p.type == parameter::file
- ? p.name + "=@" + p.value
- : p.name + "=" + p.value);
- }
-
- // Start curl program.
- //
- fdpipe pipe (fdopen_pipe ()); // Text mode seems appropriate.
+ // Start curl program.
+ //
+ fdpipe pipe (open_pipe ()); // Text mode seems appropriate.
- // Note that we don't specify any default timeouts, assuming that bdep
- // is an interactive program and the user can always interrupt the
- // command (or pass the timeout with --curl-option).
- //
- pr = start (0 /* stdin */,
- pipe /* stdout */,
- 2 /* stderr */,
- o.curl (),
- v,
- "-A", (BDEP_USER_AGENT " curl"),
+ // Note that we don't specify any default timeouts, assuming that bdep
+ // is an interactive program and the user can always interrupt the
+ // command (or pass the timeout with --curl-option).
+ //
+ process pr (start (0 /* stdin */,
+ pipe /* stdout */,
+ 2 /* stderr */,
+ o.curl (),
+ v,
+ "-A", (BDEP_USER_AGENT " curl"),
- o.curl_option (),
+ o.curl_option (),
- // Include the response headers in the output so we can
- // get the status code/reason, content type, and the
- // redirect location.
- //
- "--include",
+ // Include the response headers in the output so we
+ // can get the status code/reason, content type, and
+ // the redirect location.
+ //
+ "--include",
- fos,
- u.string ());
+ fos,
+ u.string ()));
- pipe.out.close ();
+ // Shouldn't throw, unless something is severely damaged.
+ //
+ pipe.out.close ();
+ bool io (false);
+ try
+ {
// First we read the HTTP response status line and headers. At this
// stage we will read until the empty line (containing just CRLF). Not
// being able to reach such a line is an error, which is the reason
diff --git a/bdep/http-service.hxx b/bdep/http-service.hxx
index 247fe94..75fd603 100644
--- a/bdep/http-service.hxx
+++ b/bdep/http-service.hxx
@@ -52,7 +52,7 @@ namespace bdep
// present, then it is included in the diagnostics.
//
result
- post (const common_options& o, const url&, const parameters&);
+ post (const common_options&, const url&, const parameters&);
}
}
diff --git a/bdep/publish.cxx b/bdep/publish.cxx
index c97c652..d3ea1c0 100644
--- a/bdep/publish.cxx
+++ b/bdep/publish.cxx
@@ -273,26 +273,28 @@ namespace bdep
// Verify that archive name/content all match and while at it extract
// its manifest.
//
- process pr;
+ fdpipe pipe (open_pipe ()); // Text mode seems appropriate.
+
+ // Pass the --deep option to make sure that the *-file manifest values
+ // are resolvable, so rep-create will not fail due to this package
+ // down the road.
+ //
+ process pr (start_bpkg (2 /* verbosity */,
+ o,
+ pipe /* stdout */,
+ 2 /* stderr */,
+ "pkg-verify",
+ "--deep",
+ "--manifest",
+ a));
+
+ // Shouldn't throw, unless something is severely damaged.
+ //
+ pipe.out.close ();
+
bool io (false);
try
{
- fdpipe pipe (fdopen_pipe ()); // Text mode seems appropriate.
-
- // Pass the --deep option to make sure that the *-file manifest values
- // are resolvable, so rep-create will not fail due to this package
- // down the road.
- //
- pr = start_bpkg (2 /* verbosity */,
- o,
- pipe /* stdout */,
- 2 /* stderr */,
- "pkg-verify",
- "--deep",
- "--manifest",
- a);
-
- pipe.out.close ();
ifdstream is (move (pipe.in), fdstream_mode::skip);
manifest_parser mp (is, manifest_file.string ());
@@ -375,7 +377,7 @@ namespace bdep
auto worktree_add = [&prj, &wd] ()
{
bool q (verb < 2);
- auto_fd null (q ? fdnull () : auto_fd ());
+ auto_fd null (q ? open_dev_null () : auto_fd ());
process pr (start_git (git_ver,
prj,
@@ -461,14 +463,14 @@ namespace bdep
{
// Create the empty tree object.
//
- auto_fd null (fdnull ());
- fdpipe pipe (fdopen_pipe ());
+ auto_fd null (open_dev_null ());
+ fdpipe pipe (open_pipe ());
process pr (start_git (git_ver,
prj,
- null.get () /* stdin */,
- pipe /* stdout */,
- 2 /* stderr */,
+ null /* stdin */,
+ pipe /* stdout */,
+ 2 /* stderr */,
"hash-object",
"-wt", "tree",
"--stdin"));
@@ -729,23 +731,14 @@ namespace bdep
}
}));
- if (verb)
- text << "pushing build2-control";
-
- // Note that we suppress the (too detailed) push command output if
- // the verbosity level is 1. However, we still want to see the
- // progress in this case.
- //
- run_git (git_ver,
- wd,
- "push",
+ if (verb && !o.no_progress ())
+ text << "pushing branch build2-control";
- verb < 2 ? "-q" : verb > 3 ? "-v" : nullptr,
- verb == 1 ? "--progress" : nullptr,
-
- !remote_exists
- ? cstrings ({"--set-upstream", "origin", "build2-control"})
- : cstrings ());
+ git_push (o,
+ wd,
+ (!remote_exists
+ ? cstrings ({"--set-upstream", "origin", "build2-control"})
+ : cstrings ()));
}
worktree_remove ();
@@ -758,7 +751,7 @@ namespace bdep
// The path points into the temporary directory so let's omit the
// directory part.
//
- if (verb)
+ if (verb && !o.no_progress ())
text << "submitting " << p.archive.leaf ();
url u (o.repository ());
diff --git a/bdep/release.cxx b/bdep/release.cxx
index cb4cac9..e550d32 100644
--- a/bdep/release.cxx
+++ b/bdep/release.cxx
@@ -888,17 +888,20 @@ namespace bdep
brspec = st.branch + ':' + string (st.upstream, p + 1);
}
- // Note that we suppress the (too detailed) push command output if
- // the verbosity level is 1. However, we still want to see the
- // progress in this case.
- //
- run_git (git_ver,
- prj.path,
- "push",
- verb < 1 ? "-q" : verb >= 2 ? "-v" : nullptr,
- remote,
- brspec,
- !tagspec.empty () ? tagspec.c_str () : nullptr);
+ if (verb && !o.no_progress ())
+ {
+ diag_record dr (text);
+ dr << "pushing branch " << st.branch;
+
+ if (prj.tag)
+ dr << ", tag " << *prj.tag;
+ }
+
+ git_push (o,
+ prj.path,
+ remote,
+ brspec,
+ !tagspec.empty () ? tagspec.c_str () : nullptr);
}
return 0;
diff --git a/bdep/sync.cxx b/bdep/sync.cxx
index a8514ab..d4f3983 100644
--- a/bdep/sync.cxx
+++ b/bdep/sync.cxx
@@ -33,20 +33,22 @@ namespace bdep
// Use bpkg-rep-list to discover the list of project directories.
//
- process pr;
+ fdpipe pipe (open_pipe ()); // Text mode seems appropriate.
+
+ process pr (start_bpkg (3,
+ co,
+ pipe /* stdout */,
+ 2 /* stderr */,
+ "rep-list",
+ "-d", cfg));
+
+ // Shouldn't throw, unless something is severely damaged.
+ //
+ pipe.out.close ();
+
bool io (false);
try
{
- fdpipe pipe (fdopen_pipe ()); // Text mode seems appropriate.
-
- pr = start_bpkg (3,
- co,
- pipe /* stdout */,
- 2 /* stderr */,
- "rep-list",
- "-d", cfg);
-
- pipe.out.close ();
ifdstream is (move (pipe.in), fdstream_mode::skip, ifdstream::badbit);
for (string l; !eof (getline (is, l)); )
diff --git a/bdep/utility.cxx b/bdep/utility.cxx
index b670587..8caedc6 100644
--- a/bdep/utility.cxx
+++ b/bdep/utility.cxx
@@ -80,6 +80,8 @@ namespace bdep
}
}
+ bool stderr_term;
+
bool
exists (const path& f, bool ignore_error)
{
@@ -174,6 +176,32 @@ namespace bdep
}
}
+ fdpipe
+ open_pipe ()
+ {
+ try
+ {
+ return fdopen_pipe ();
+ }
+ catch (const io_error& e)
+ {
+ fail << "unable to open pipe: " << e << endf;
+ }
+ }
+
+ auto_fd
+ open_dev_null ()
+ {
+ try
+ {
+ return fdnull ();
+ }
+ catch (const io_error& e)
+ {
+ fail << "unable to open null device: " << e << endf;
+ }
+ }
+
const char*
name_bpkg (const common_options& co)
{
diff --git a/bdep/utility.hxx b/bdep/utility.hxx
index fcf0963..c4d406c 100644
--- a/bdep/utility.hxx
+++ b/bdep/utility.hxx
@@ -67,11 +67,6 @@ namespace bdep
using butl::auto_rmfile;
using butl::auto_rmdir;
- // <libbutl/fdstream.mxx>
- //
- using butl::fdnull;
- using butl::fdopen_pipe;
-
// Empty string and path.
//
extern const string empty_string;
@@ -119,6 +114,10 @@ namespace bdep
//
extern dir_path exec_dir;
+ // Progress.
+ //
+ extern bool stderr_term; // True if stderr is a terminal.
+
// Filesystem.
//
bool
@@ -147,6 +146,14 @@ namespace bdep
uint16_t verbosity = 3,
rm_error_mode = rm_error_mode::fail);
+ // File descriptor streams.
+ //
+ fdpipe
+ open_pipe ();
+
+ auto_fd
+ open_dev_null ();
+
// Run a process.
//
template <typename I, typename O, typename E, typename P, typename... A>
diff --git a/bdep/utility.txx b/bdep/utility.txx
index 4686ba2..2927002 100644
--- a/bdep/utility.txx
+++ b/bdep/utility.txx
@@ -2,6 +2,7 @@
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
+#include <cstring> // strcmp()
#include <iostream> // cin
#include <bdep/diagnostics.hxx>
@@ -91,6 +92,7 @@ namespace bdep
string vl;
{
const char* o (nullptr);
+ bool progress (!co.no_progress ());
switch (verb)
{
@@ -106,7 +108,15 @@ namespace bdep
}
if (o != nullptr)
+ {
ops.push_back (o);
+
+ if (strcmp (o, "-q") == 0)
+ progress = true; // No need to suppress (already done with -q).
+ }
+
+ if (!progress)
+ ops.push_back ("--no-progress");
}
// Forward our --build* options.
@@ -180,6 +190,7 @@ namespace bdep
string vl;
{
const char* o (nullptr);
+ bool progress (!co.no_progress ());
switch (verb)
{
@@ -195,7 +206,15 @@ namespace bdep
}
if (o != nullptr)
+ {
ops.push_back (o);
+
+ if (strcmp (o, "-q") == 0)
+ progress = true; // No need to suppress (already done with -q).
+ }
+
+ if (!progress)
+ ops.push_back ("--no-progress");
}
return process_start_callback (
diff --git a/tests/ci.testscript b/tests/ci.testscript
index bea287d..9d61fc0 100644
--- a/tests/ci.testscript
+++ b/tests/ci.testscript
@@ -59,6 +59,11 @@ init += $cxx -d prj 2>! &prj/**/bootstrap/***
windows = ($cxx.target.class == 'windows')
+# Normally we disable the progress indication that complicates stderr output
+# validation. When testing the progress indication specifically we need to
+# handle curl's progress carefully, as it is not always terminated with the
+# newline character on Windows.
+#
: single-pkg
:
{
@@ -68,10 +73,22 @@ windows = ($cxx.target.class == 'windows')
$clone_root_prj;
$init -C @cfg &prj-cfg/***;
+ $* --no-progress 2>>~%EOE%
+ %CI request is queued.*%
+ %reference: .+%
+ EOE
+ }
+
+ : progress
+ :
+ {
+ $clone_root_prj;
+ $init -C @cfg &prj-cfg/***;
+
$* 2>>~"%EOE%"
submitting to $server
%.*
- %CI request is queued.*%
+ %.*CI request is queued.*%
%reference: .+%
EOE
}
@@ -146,15 +163,15 @@ windows = ($cxx.target.class == 'windows')
+$g commit -m 'Create'
+$g push --set-upstream origin master
+ test.options += --no-progress
+
: both
:
{
$clone_prj;
$init -C @cfg &prj-cfg/***;
- $* 2>>~"%EOE%"
- submitting to $server
- %.*
+ $* 2>>~%EOE%
%CI request is queued.*%
%reference: .+%
EOE
@@ -170,9 +187,7 @@ windows = ($cxx.target.class == 'windows')
#
test.arguments = $regex.apply($test.arguments, '^(prj)$', '\1/libprj');
- $* 2>>~"%EOE%"
- submitting to $server
- %.*
+ $* 2>>~%EOE%
%CI request is queued.*%
%reference: .+%
EOE
@@ -198,8 +213,7 @@ windows = ($cxx.target.class == 'windows')
package: prj
version: 1.0.1
- %.*
- %CI request is queued.*%
+ %continue\\?.+ CI request is queued.*%
%reference: .+%
EOE
}
diff --git a/tests/publish.testscript b/tests/publish.testscript
index 55bc01a..935a8e1 100644
--- a/tests/publish.testscript
+++ b/tests/publish.testscript
@@ -43,7 +43,13 @@ g = 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.19
+# Next version to use: 1.0.20
+#
+
+# Normally we disable the progress indication that complicates stderr output
+# validation. When testing the progress indication specifically we need to
+# handle curl's progress carefully, as it is not always terminated with the
+# newline character on Windows.
#
: submit
:
@@ -64,16 +70,31 @@ g = git -C prj >! 2>!
$init -C @cfg &prj-cfg/***;
sed -i -e 's/^(version:) .*$/\1 1.0.1/' prj/manifest;
- $* 2>>~%EOE%
+ $* --no-progress 2>>~%EOE%
synchronizing:
upgrade prj/1.0.1
- submitting prj-1.0.1.tar.gz
- %.*
%package submission is queued(: \.*prj/1.0.1)?%d
%reference: .{12}%
EOE
}
+ : progress
+ :
+ {
+ $clone_root_prj;
+ $init -C @cfg &prj-cfg/***;
+ sed -i -e 's/^(version:) .*$/\1 1.0.19/' prj/manifest;
+
+ $* 2>>~%EOE%
+ synchronizing:
+ upgrade prj/1.0.19
+ submitting prj-1.0.19.tar.gz
+ %.*
+ %.*package submission is queued(: \.*prj/1.0.19)?%d
+ %reference: .{12}%
+ EOE
+ }
+
: no-cfg
:
{
@@ -117,6 +138,7 @@ g = git -C prj >! 2>!
: multi-pkg
:
{
+ test.options += --no-progress
test.arguments += --force=uncommitted --simulate 'success'
+$new -t empty prj &prj/***
@@ -132,12 +154,8 @@ g = git -C prj >! 2>!
$init -C @cfg &prj-cfg/***;
$* 2>>~%EOE%
- submitting libprj-1.0.2.tar.gz
- %.*
%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)?%d
%reference: .{12}%
EOE
@@ -155,8 +173,6 @@ g = git -C prj >! 2>!
test.arguments = $regex.apply($test.arguments, '^(prj)$', '\1/libprj');
$* 2>>~%EOE%
- submitting libprj-1.0.3.tar.gz
- %.*
%package submission is queued(: \.*prj/1.0.3)?%d
%reference: .{12}%
EOE
@@ -189,12 +205,8 @@ g = git -C prj >! 2>!
project: prj
section: stable
%warning: publishing using staged build2 toolchain%?
- continue? [y/n] submitting libprj-1.0.4.tar.gz
- %.*
- %package submission is queued\(: \\.*libprj/1.0.4\)?%d
+ %continue\\?\\.+ 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\)?%d
%reference: .{12}%
EOE
@@ -204,6 +216,7 @@ g = git -C prj >! 2>!
: commited-prj
:
{
+ test.options += --no-progress
test.arguments += --simulate 'success'
clone_prj = cp --no-cleanup -p -r ../prj ./ &prj/***
@@ -234,8 +247,6 @@ g = git -C prj >! 2>!
$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
@@ -274,8 +285,6 @@ g = git -C prj >! 2>!
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
@@ -285,6 +294,7 @@ g = git -C prj >! 2>!
: non-vsc-prj
:
{
+ test.options += --no-progress
test.arguments += --simulate 'success'
clone_prj = cp --no-cleanup -p -r ../prj ./ &prj/***;
@@ -298,8 +308,6 @@ g = git -C prj >! 2>!
$* 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
@@ -308,6 +316,7 @@ g = git -C prj >! 2>!
: failure
:
{
+ test.options += --no-progress
test.arguments += --force=uncommitted
: duplicate-archive
@@ -322,8 +331,6 @@ g = git -C prj >! 2>!
$* 2>>~%EOE% != 0
synchronizing:
upgrade prj/1.0.5
- submitting prj-1.0.5.tar.gz
- %.*
error: duplicate submission
% info: reference: .{12}%?
EOE
@@ -341,8 +348,6 @@ g = git -C prj >! 2>!
$* 2>>~%EOE% != 0
synchronizing:
upgrade prj/1.0.6
- submitting prj-1.0.6.tar.gz
- %.*
error: submission handling failed
% info: consider reporting this to .+ maintainers%
EOE
@@ -360,8 +365,6 @@ g = git -C prj >! 2>!
$* 2>>~%EOE% != 0
synchronizing:
upgrade prj/1.0.7
- submitting prj-1.0.7.tar.gz
- %.*
error: HTTP status code 500 (internal server error)
% info: consider reporting this to .+ maintainers%
EOE
@@ -414,14 +417,16 @@ g = git -C prj >! 2>!
$* >&2 2>>~%EOE%;
synchronizing:
upgrade prj/1.0.8
- pushing build2-control
+ pushing branch build2-control
%.*
submitting prj-1.0.8.tar.gz
- %.*
- %package submission is queued(: \.*prj/1.0.8)?%d
+ %.+
+ %.*package submission is queued(: \.*prj/1.0.8)?%d
%reference: .{12}%
EOE
+ test.options += --no-progress;
+
# Publish when both local and remote-tracking build2-control branches are
# present.
#
@@ -430,10 +435,6 @@ g = git -C prj >! 2>!
$* 2>>~%EOE%;
synchronizing:
upgrade prj/1.0.9
- pushing build2-control
- %.*
- submitting prj-1.0.9.tar.gz
- %.*
%package submission is queued(: \.*prj/1.0.9)?%d
%reference: .{12}%
EOE
@@ -448,10 +449,6 @@ g = git -C prj >! 2>!
$* 2>>~%EOE%;
synchronizing:
upgrade prj/1.0.10
- pushing build2-control
- %.*
- submitting prj-1.0.10.tar.gz
- %.*
%package submission is queued(: \.*prj/1.0.10)?%d
%reference: .{12}%
EOE
@@ -519,21 +516,19 @@ g = git -C prj >! 2>!
$* 2>>~%EOE% != 0;
synchronizing:
upgrade prj/1.0.12
- pushing build2-control
+ pushing branch build2-control
%.*
error: unable to push build2-control branch
info: run 'git fetch' and try again
EOE
+ test.options += --no-progress;
+
# Publish successfully after the fetch.
#
$g fetch;
$* 2>>~%EOE%;
- pushing build2-control
- %.*
- submitting prj-1.0.12.tar.gz
- %.*
%package submission is queued(: \.*prj/1.0.12)?%d
%reference: .{12}%
EOE
@@ -548,10 +543,7 @@ g = git -C prj >! 2>!
$* >&2 2>>~%EOE%;
synchronizing:
upgrade prj/1.0.13
- pushing build2-control
- %.*
- submitting prj-1.0.13.tar.gz
- %.*
+ Branch 'build2-control' set up to track remote branch 'build2-control' from 'origin'.
%package submission is queued(: \.*prj/1.0.13)?%d
%reference: .{12}%
EOE
@@ -577,7 +569,6 @@ g = git -C prj >! 2>!
$* 2>>~%EOE% != 0;
synchronizing:
upgrade prj/1.0.14
- pushing build2-control
%.*
error: unable to push build2-control branch
info: run 'git fetch' and try again
@@ -589,10 +580,6 @@ g = git -C prj >! 2>!
$g pull;
$* 2>>~%EOE%;
- pushing build2-control
- %.*
- submitting prj-1.0.14.tar.gz
- %.*
%package submission is queued(: \.*prj/1.0.14)?%d
%reference: .{12}%
EOE
diff --git a/tests/release.testscript b/tests/release.testscript
index 45d6867..7ed968f 100644
--- a/tests/release.testscript
+++ b/tests/release.testscript
@@ -56,7 +56,7 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
: single-pkg
:
{
- test.arguments += --yes -q
+ test.arguments += --yes
: release
:
@@ -71,7 +71,10 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
{
$clone_root_repos;
- $*;
+ $* 2>>~%EOE%;
+ %.+
+ pushing branch master, tag v0.1.0
+ EOE
$clone2;
$log2 >>:~%EOO%;
@@ -94,7 +97,10 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
{
$clone_root_repos;
- $* --alpha;
+ $* --alpha 2>>~%EOE%;
+ %.+
+ pushing branch master, tag v0.1.0-a.1
+ EOE
$clone2;
$log2 >>:~%EOO%
@@ -109,7 +115,10 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
{
$clone_root_repos;
- $* --beta;
+ $* --beta 2>>~%EOE%;
+ %.+
+ pushing branch master, tag v0.1.0-b.1
+ EOE
$clone2;
$log2 >>:~%EOO%
@@ -124,7 +133,10 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
{
$clone_root_repos;
- $* --minor;
+ $* --minor 2>>~%EOE%;
+ %.+
+ pushing branch master, tag v0.2.0
+ EOE
$clone2;
$log2 >>:~%EOO%
@@ -139,7 +151,10 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
{
$clone_root_repos;
- $* --major;
+ $* --major 2>>~%EOE%;
+ %.+
+ pushing branch master, tag v1.0.0
+ EOE
$clone2;
$log2 >>:~%EOO%
@@ -162,7 +177,10 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
$* --open-beta 2>'error: --open-beta specified for final current version 0.1.0' != 0;
- $* --alpha --open-beta;
+ $* --alpha --open-beta 2>>~%EOE%;
+ %.+
+ pushing branch master, tag v0.1.0-a.1
+ EOE
$clone2;
$log2 >>:~%EOO%;
@@ -171,7 +189,10 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
Create
EOO
- $* --beta --open-beta;
+ $* --beta --open-beta 2>>~%EOE%;
+ %.+
+ pushing branch master, tag v0.1.0-b.1
+ EOE
$pull2;
$log2 >>:~%EOO%
@@ -188,7 +209,10 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
{
$clone_root_repos;
- $* --open-patch;
+ $* --open-patch 2>>~%EOE%;
+ %.+
+ pushing branch master, tag v0.1.0
+ EOE
$clone2;
$log2 >>:~%EOO%;
@@ -197,7 +221,12 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
Create
EOO
- $*; # --open-patch is implied for bugfix release series.
+ # Note: --open-patch is implied for bugfix release series.
+ #
+ $* 2>>~%EOE%;
+ %.+
+ pushing branch master, tag v0.1.1
+ EOE
$pull2;
$log2 >>:~%EOO%
@@ -217,9 +246,20 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
$* --alpha --open-minor 2>'error: --open-minor specified for alpha current version 0.1.0-a.1' != 0;
$* --beta --open-minor 2>'error: --open-minor specified for beta current version 0.1.0-b.1' != 0;
- $* --open-patch;
- $*;
- $* --open-minor;
+ $* --open-patch 2>>~%EOE%;
+ %.+
+ pushing branch master, tag v0.1.0
+ EOE
+
+ $* 2>>~%EOE%;
+ %.+
+ pushing branch master, tag v0.1.1
+ EOE
+
+ $* --open-minor 2>>~%EOE%;
+ %.+
+ pushing branch master, tag v0.1.2
+ EOE
$clone2;
$log2 >>:~%EOO%
@@ -238,7 +278,10 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
{
$clone_root_repos;
- $* --open-major;
+ $* --open-major 2>>~%EOE%;
+ %.+
+ pushing branch master, tag v0.1.0
+ EOE
$clone2;
$log2 >>:~%EOO%
@@ -259,7 +302,10 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
{
$clone_root_repos;
- $* --no-open;
+ $* --no-open 2>>~%EOE%;
+ %.+
+ pushing branch master, tag v0.1.0
+ EOE
$clone2;
$log2 >>:~%EOO%;
@@ -267,7 +313,10 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
Create
EOO
- $* --open;
+ $* --open 2>>~%EOE%;
+ %.+
+ pushing branch master
+ EOE
$pull2;
$log2 >>:~%EOO%
@@ -282,7 +331,10 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
{
$clone_root_repos;
- $* --no-tag;
+ $* --no-tag 2>>~%EOE%;
+ %.+
+ pushing branch master
+ EOE
$clone2;
$log2 >>:~%EOO%;
@@ -296,7 +348,9 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
info: use --force=snapshot to tag anyway
EOE
- $* --tag --force=snapshot;
+ $* --tag --force=snapshot 2>>~%EOE%;
+ %pushing branch master, tag v0.2.0-a.0.\.+%d
+ EOE
$pull2;
$log2 >>:~%EOO%
@@ -311,7 +365,10 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
{
$clone_root_repos;
- $* --no-tag --no-open;
+ $* --no-tag --no-open 2>>~%EOE%;
+ %.+
+ pushing branch master
+ EOE
$clone2;
$log2 >>:~%EOO%;
@@ -319,7 +376,9 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
Create
EOO
- $* --tag;
+ $* --tag 2>>EOE;
+ pushing branch master, tag v0.1.0
+ EOE
$pull2;
$log2 >>:~%EOO%;
@@ -327,7 +386,10 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
Create
EOO
- $* --open;
+ $* --open 2>>~%EOE%;
+ %.+
+ pushing branch master
+ EOE
$pull2;
$log2 >>:~%EOO%
@@ -348,6 +410,7 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
: validate-manifest
{
+ test.options += -q
test.arguments += --push
: file-value
@@ -406,7 +469,7 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
$* --no-commit;
$gp commit -a -m 'Release version';
- $* --tag --push;
+ $* --tag --push -q;
$clone2;
$log2 >>:~%EOO%
@@ -419,6 +482,8 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
: revision
:
{
+ test.options += -q
+
+$clone_root_repos
+$* --no-open --push
@@ -532,6 +597,8 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
: open
:
{
+ test.options += -q
+
: unstaged
:
{
@@ -589,6 +656,26 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
Create
EOO
}
+
+ : no-progress
+ :
+ {
+ $clone_root_repos;
+
+ $* --push --no-progress 2>>~%EOE%;
+ %\.+ Release version 0.1.0%d
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+ %\.+ Change version to 0.2.0-a.0.z%d
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+ EOE
+
+ $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
+ }
}
: multi-pkg
@@ -613,7 +700,8 @@ log2 = $gp2 log '--pretty=format:"%d %s"'
+$gp commit -m 'Create'
+$gp push --set-upstream origin master
- test.arguments += --push -q
+ test.options += -q
+ test.arguments += --push
: patch
: