aboutsummaryrefslogtreecommitdiff
path: root/build2/test
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-01-27 15:25:26 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-02-13 12:42:41 +0200
commitf93038fbee1631b95922b0742e0fd00fa8dae02e (patch)
tree6fe67cbde528ee8ded490085b9a8d5adc0ce5aca /build2/test
parent267d34d2800d9cc3ed2865cbecf8d32f8f1ab6ec (diff)
Add notion of phase, enforce
Diffstat (limited to 'build2/test')
-rw-r--r--build2/test/common2
-rw-r--r--build2/test/common.cxx22
-rw-r--r--build2/test/rule.cxx6
-rw-r--r--build2/test/script/script.cxx5
4 files changed, 24 insertions, 11 deletions
diff --git a/build2/test/common b/build2/test/common
index e9213b6..d3678c8 100644
--- a/build2/test/common
+++ b/build2/test/common
@@ -21,7 +21,7 @@ namespace build2
const names* test_ = nullptr; // The config.test value if any.
scope* root_ = nullptr; // The root scope for target resolution.
- // Return true if the specified alias target should pass-through to it
+ // Return true if the specified alias target should pass-through to its
// prerequisites.
//
bool
diff --git a/build2/test/common.cxx b/build2/test/common.cxx
index 66be9d8..1b4c194 100644
--- a/build2/test/common.cxx
+++ b/build2/test/common.cxx
@@ -136,14 +136,19 @@ namespace build2
r = d.sub (n->dir);
else
// First quickly and cheaply weed out names that cannot possibly
- // match. Only then search for a target as if it was a prerequisite,
- // which can be expensive.
+ // match. Only then search for a target (as if it was a
+ // prerequisite), which can be expensive.
+ //
+ // We cannot specify an src target in config.test since we used
+ // the pair separator for ids. As a result, we search for both
+ // out and src targets.
//
r =
- t.name == n->value && // Name matches.
- tt.name == n->type && // Target type matches.
- d == n->dir && // Directory matches.
- search (*n, *root_) == t;
+ t.name == n->value && // Name matches.
+ tt.name == n->type && // Target type matches.
+ d == n->dir && // Directory matches.
+ (search_existing (*n, *root_) == &t ||
+ search_existing (*n, *root_, d) == &t);
if (r)
break;
@@ -189,8 +194,9 @@ namespace build2
r =
t.name == n->value &&
tt.name == n->type &&
- d == n->dir &&
- search (*n, *root_) == t;
+ d == n->dir &&
+ (search_existing (*n, *root_) == &t ||
+ search_existing (*n, *root_, d) == &t);
if (!r)
continue; // Not our target.
diff --git a/build2/test/rule.cxx b/build2/test/rule.cxx
index 17821a4..6b06dca 100644
--- a/build2/test/rule.cxx
+++ b/build2/test/rule.cxx
@@ -589,7 +589,11 @@ namespace build2
//
// @@ OUT: what if this is a @-qualified pair or names?
//
- t = &search (*n, tt.base_scope ());
+ t = search_existing (*n, tt.base_scope ());
+
+ if (t == nullptr)
+ fail << "invalid test executable override: unknown target: '"
+ << n << "'";
}
}
else
diff --git a/build2/test/script/script.cxx b/build2/test/script/script.cxx
index 342cae9..bd13845 100644
--- a/build2/test/script/script.cxx
+++ b/build2/test/script/script.cxx
@@ -549,7 +549,10 @@ namespace build2
//
// @@ OUT: what if this is a @-qualified pair or names?
//
- t = &search (*n, tt.base_scope ());
+ t = search_existing (*n, tt.base_scope ());
+
+ if (t == nullptr)
+ fail << "unknown target '" << n << "' in test variable";
}
}
else