aboutsummaryrefslogtreecommitdiff
path: root/build2/test/script/runner.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-01-11 10:14:23 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-01-12 10:58:19 +0200
commit9bf93c1ab73ee3cd2b763285fc5fc5456e972854 (patch)
tree0357c36e12fe2137ef6c9bd228e9d69bb2489a02 /build2/test/script/runner.cxx
parent33ed305eac57bff406fa3f672ba8acc4941e8f13 (diff)
Implement support for narrowing down tests (config.test)
Diffstat (limited to 'build2/test/script/runner.cxx')
-rw-r--r--build2/test/script/runner.cxx32
1 files changed, 20 insertions, 12 deletions
diff --git a/build2/test/script/runner.cxx b/build2/test/script/runner.cxx
index 64c6e87..522dedd 100644
--- a/build2/test/script/runner.cxx
+++ b/build2/test/script/runner.cxx
@@ -10,6 +10,9 @@
#include <butl/fdstream> // fdopen_mode, fdnull(), fddup()
#include <build2/filesystem>
+
+#include <build2/test/common>
+
#include <build2/test/script/builtin>
using namespace std;
@@ -310,21 +313,26 @@ namespace build2
}
}
+ bool default_runner::
+ test (scope& s) const
+ {
+ return common_.test (s.root->test_target, s.id_path);
+ }
+
void default_runner::
enter (scope& sp, const location&)
{
- if (!exists (sp.wd_path))
- // @@ Shouldn't we add an optional location parameter to mkdir() and
- // alike utility functions so the failure message can contain
- // location info?
- //
- mkdir (sp.wd_path, 2);
- else
- // Scope working directory shall be empty (the script working
- // directory is cleaned up by the test rule prior the script
- // execution).
- //
- assert (empty (sp.wd_path));
+ // Scope working directory shall be empty (the script working
+ // directory is cleaned up by the test rule prior the script
+ // execution).
+ //
+ // @@ Shouldn't we add an optional location parameter to mkdir() and
+ // alike utility functions so the failure message can contain
+ // location info?
+ //
+ if (mkdir (sp.wd_path, 2) == mkdir_status::already_exists)
+ fail << "working directory " << sp.wd_path << " already exists" <<
+ info << "are tests stomping on each other's feet?";
// We don't change the current directory here but indicate that the
// scope test commands will be executed in that directory.