aboutsummaryrefslogtreecommitdiff
path: root/build2/test
diff options
context:
space:
mode:
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