aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/dist/operation.cxx23
-rw-r--r--build2/test/rule.cxx9
-rw-r--r--old-tests/test/generated/buildfile3
-rw-r--r--old-tests/test/generated/driver.cxx2
-rw-r--r--old-tests/test/generated/test.out1
5 files changed, 29 insertions, 9 deletions
diff --git a/build2/dist/operation.cxx b/build2/dist/operation.cxx
index 027452f..5c08c50 100644
--- a/build2/dist/operation.cxx
+++ b/build2/dist/operation.cxx
@@ -112,20 +112,33 @@ namespace build2
// Match a rule for every operation supported by this project. Skip
// default_id.
//
+ // Note that we are not calling operation_pre/post() callbacks here
+ // since the meta operation is dist and we know what we are doing.
+ //
for (operations::size_type id (default_id + 1);
id < rs->operations.size ();
++id)
{
if (const operation_info* oif = rs->operations[id])
{
- // Note that we are not calling operation_pre/post() callbacks here
- // since the meta operation is dist and we know what we are doing.
- //
- set_current_oif (*oif);
-
// Use standard (perform) match.
//
+ if (oif->pre != nullptr)
+ {
+ const operation_info* poif (rs->operations[oif->pre (dist_id)]);
+ set_current_oif (*poif, oif);
+ match (action (dist_id, poif->id, oif->id), ts);
+ }
+
+ set_current_oif (*oif);
match (action (dist_id, oif->id), ts);
+
+ if (oif->post != nullptr)
+ {
+ const operation_info* poif (rs->operations[oif->post (dist_id)]);
+ set_current_oif (*poif, oif);
+ match (action (dist_id, poif->id, oif->id), ts);
+ }
}
}
diff --git a/build2/test/rule.cxx b/build2/test/rule.cxx
index 06ffc9f..02026e8 100644
--- a/build2/test/rule.cxx
+++ b/build2/test/rule.cxx
@@ -140,11 +140,14 @@ namespace build2
// for (update, test), and not simply "guide" (update, 0) as to which
// targets need updating. For how exactly we are going to do it, see
// apply() below.
- //
+
// Change the recipe action to (update, 0) (i.e., "unconditional
- // update") to make sure we won't match any prerequisites.
+ // update") for "leaf" tests to make sure we won't match any
+ // prerequisites. Note that this doesn't cover the case where an alias
+ // is both a test and a pass for a test prerequisite with generated
+ // input/output.
//
- if (a.operation () == update_id && (md.pass || md.test))
+ if (a.operation () == update_id && md.test)
mr.recipe_action = action (a.meta_operation (), update_id);
// Note that we match even if this target is not testable so that we can
diff --git a/old-tests/test/generated/buildfile b/old-tests/test/generated/buildfile
index aacca8b..d3fbc20 100644
--- a/old-tests/test/generated/buildfile
+++ b/old-tests/test/generated/buildfile
@@ -4,6 +4,7 @@ using cxx
exe{utility}: cxx{utility}
exe{driver}: cxx{driver}
-exe{driver}: test.input = exe{utility}
+exe{driver}: test.input = exe{utility} # Update test.
+exe{driver}: test.output = file{test.out} # Dist test.
./: exe{driver}
diff --git a/old-tests/test/generated/driver.cxx b/old-tests/test/generated/driver.cxx
index 008dbf7..f674141 100644
--- a/old-tests/test/generated/driver.cxx
+++ b/old-tests/test/generated/driver.cxx
@@ -20,5 +20,7 @@ main (int argc, char* argv[])
if (ifs.tellg () == 0)
cerr << argv[1] << " is empty" << endl;
+ cout << "output" << endl;
+
return 0;
}
diff --git a/old-tests/test/generated/test.out b/old-tests/test/generated/test.out
new file mode 100644
index 0000000..53752db
--- /dev/null
+++ b/old-tests/test/generated/test.out
@@ -0,0 +1 @@
+output