From dc74915e47968c40c497fb6d53144bb815ca5cfb Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 3 Mar 2017 14:57:29 +0200 Subject: Fix test and dist for generated input/output --- build2/dist/operation.cxx | 23 ++++++++++++++++++----- build2/test/rule.cxx | 9 ++++++--- 2 files changed, 24 insertions(+), 8 deletions(-) (limited to 'build2') 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 -- cgit v1.1