Path: blob/main/contrib/kyua/drivers/list_tests.hpp
39478 views
// Copyright 2011 The Kyua Authors.1// All rights reserved.2//3// Redistribution and use in source and binary forms, with or without4// modification, are permitted provided that the following conditions are5// met:6//7// * Redistributions of source code must retain the above copyright8// notice, this list of conditions and the following disclaimer.9// * Redistributions in binary form must reproduce the above copyright10// notice, this list of conditions and the following disclaimer in the11// documentation and/or other materials provided with the distribution.12// * Neither the name of Google Inc. nor the names of its contributors13// may be used to endorse or promote products derived from this software14// without specific prior written permission.15//16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.2728/// \file drivers/list_tests.hpp29/// Driver to obtain a list of test cases out of a test suite.30///31/// This driver module implements the logic to extract a list of test cases out32/// of a particular test suite.3334#if !defined(DRIVERS_LIST_TESTS_HPP)35#define DRIVERS_LIST_TESTS_HPP3637#include <set>38#include <string>3940#include "engine/filters_fwd.hpp"41#include "model/test_program_fwd.hpp"42#include "utils/config/tree_fwd.hpp"43#include "utils/fs/path_fwd.hpp"44#include "utils/optional_fwd.hpp"4546namespace drivers {47namespace list_tests {484950/// Abstract definition of the hooks for this driver.51class base_hooks {52public:53virtual ~base_hooks(void) = 0;5455/// Called when a test case is identified in a test suite.56///57/// \param test_program The test program containing the test case.58/// \param test_case_name The name of the located test case.59virtual void got_test_case(const model::test_program& test_program,60const std::string& test_case_name) = 0;61};626364/// Tuple containing the results of this driver.65class result {66public:67/// Filters that did not match any available test case.68///69/// The presence of any filters here probably indicates a usage error. If a70/// test filter does not match any test case, it is probably a typo.71std::set< engine::test_filter > unused_filters;7273/// Initializer for the tuple's fields.74///75/// \param unused_filters_ The filters that did not match any test case.76result(const std::set< engine::test_filter >& unused_filters_) :77unused_filters(unused_filters_)78{79}80};818283result drive(const utils::fs::path&, const utils::optional< utils::fs::path >,84const std::set< engine::test_filter >&,85const utils::config::tree&, base_hooks&);868788} // namespace list_tests89} // namespace drivers9091#endif // !defined(DRIVERS_LIST_TESTS_HPP)929394