Fix for cl/660491962: If `names_to_test` is exhausted by a suite, we still shouldn't run ANY tests of subsequent ones.

PiperOrigin-RevId: 661017145
pull/17762/head
Yamil Morales 8 months ago committed by Copybara-Service
parent 61b96ddbbd
commit b0fd2257c0
  1. 9
      conformance/conformance_test.h
  2. 6
      conformance/conformance_test_runner.cc

@ -18,6 +18,7 @@
#include <cstdint>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "google/protobuf/descriptor.pb.h"
@ -161,14 +162,14 @@ class ConformanceTestSuite {
// Sets if we are running the test in debug mode.
void SetDebug(bool debug) { debug_ = debug; }
// Sets the testee name
// Sets if we are running ONLY the tests provided in the 'names_to_test_' set.
void SetIsolated(bool isolated) { isolated_ = isolated; }
// Sets the file path of the testee.
void SetTestee(const std::string& testee) { testee_ = testee; }
// Sets the names of tests to ONLY be run isolated from all the others.
void SetNamesToTest(absl::flat_hash_set<std::string> names_to_test) {
if (!names_to_test.empty()) {
isolated_ = true;
}
names_to_test_ = std::move(names_to_test);
}

@ -236,6 +236,7 @@ int ForkPipeRunner::Run(int argc, char *argv[],
Edition maximum_edition = EDITION_UNKNOWN;
std::string output_dir;
bool verbose = false;
bool isolated = false;
for (int arg = 1; arg < argc; ++arg) {
if (strcmp(argv[arg], "--performance") == 0) {
@ -287,6 +288,10 @@ int ForkPipeRunner::Run(int argc, char *argv[],
UsageError();
}
if (!names_to_test.empty()) {
isolated = true;
}
bool all_ok = true;
for (ConformanceTestSuite *suite : suites) {
string failure_list_filename;
@ -306,6 +311,7 @@ int ForkPipeRunner::Run(int argc, char *argv[],
suite->SetDebug(debug);
suite->SetNamesToTest(names_to_test);
suite->SetTestee(program);
suite->SetIsolated(isolated);
ForkPipeRunner runner(program, program_args, performance);

Loading…
Cancel
Save