mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-09 21:24:14 +00:00
Integration tests: Set up CI testing for TypeGraph
CTest can't forward command line arguments to the test runner, so add the option to using an environment variable to enable features instead. CMake issue tracking the feature that would have been needed: https://gitlab.kitware.com/cmake/cmake/-/issues/20470 Tests which aren't passing yet have been disabled in CI.
This commit is contained in:
parent
1bb0c62987
commit
4dc9007166
@ -14,9 +14,17 @@ workflows:
|
|||||||
name: test-gcc
|
name: test-gcc
|
||||||
requires:
|
requires:
|
||||||
- build-gcc
|
- build-gcc
|
||||||
|
- test:
|
||||||
|
name: test-type-graph-gcc
|
||||||
|
requires:
|
||||||
|
- build-gcc
|
||||||
|
oid_test_args: "-ftype-graph"
|
||||||
|
tests_regex: "OidIntegration\\..*"
|
||||||
|
exclude_regex: ".*inheritance_polymorphic.*|.*fbstring.*"
|
||||||
- coverage:
|
- coverage:
|
||||||
requires:
|
requires:
|
||||||
- test-gcc
|
- test-gcc
|
||||||
|
- test-type-graph-gcc
|
||||||
|
|
||||||
- build:
|
- build:
|
||||||
name: build-clang
|
name: build-clang
|
||||||
@ -27,6 +35,13 @@ workflows:
|
|||||||
name: test-clang
|
name: test-clang
|
||||||
requires:
|
requires:
|
||||||
- build-clang
|
- build-clang
|
||||||
|
- test:
|
||||||
|
name: test-type-graph-clang
|
||||||
|
requires:
|
||||||
|
- build-clang
|
||||||
|
oid_test_args: "-ftype-graph"
|
||||||
|
tests_regex: "OidIntegration\\..*"
|
||||||
|
exclude_regex: ".*inheritance_polymorphic.*|.*fbstring.*|.*std_string_*|.*multi_arg_tb_.*|.*ignored_a"
|
||||||
|
|
||||||
executors:
|
executors:
|
||||||
ubuntu-docker:
|
ubuntu-docker:
|
||||||
@ -132,6 +147,16 @@ jobs:
|
|||||||
|
|
||||||
test:
|
test:
|
||||||
executor: big-boy
|
executor: big-boy
|
||||||
|
parameters:
|
||||||
|
oid_test_args:
|
||||||
|
type: string
|
||||||
|
default: ""
|
||||||
|
tests_regex:
|
||||||
|
type: string
|
||||||
|
default: ".*"
|
||||||
|
exclude_regex:
|
||||||
|
type: string
|
||||||
|
default: ""
|
||||||
working_directory:
|
working_directory:
|
||||||
/tmp/object-introspection
|
/tmp/object-introspection
|
||||||
steps:
|
steps:
|
||||||
@ -155,9 +180,16 @@ jobs:
|
|||||||
OMP_NUM_THREADS: 1
|
OMP_NUM_THREADS: 1
|
||||||
command: |
|
command: |
|
||||||
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
|
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
|
||||||
ctest --test-dir build/test/ --test-action Test -j 16 \
|
OID_TEST_ARGS='<< parameters.oid_test_args >>' ctest \
|
||||||
--no-compress-output --output-on-failure \
|
--test-dir build/test/ \
|
||||||
--schedule-random --timeout 60 \
|
--test-action Test \
|
||||||
|
-j 16 \
|
||||||
|
--tests-regex '<< parameters.tests_regex >>' \
|
||||||
|
--exclude-regex '<< parameters.exclude_regex >>' \
|
||||||
|
--no-compress-output \
|
||||||
|
--output-on-failure \
|
||||||
|
--schedule-random \
|
||||||
|
--timeout 60 \
|
||||||
--output-junit results.xml
|
--output-junit results.xml
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: build/test/results.xml
|
path: build/test/results.xml
|
||||||
|
@ -23,6 +23,13 @@ additional options to aid debugging:
|
|||||||
ctest --test-dir build/test/integration -j$(nproc) [--tests-regex <regex>]
|
ctest --test-dir build/test/integration -j$(nproc) [--tests-regex <regex>]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Additional command line arguments can be passed to oid by setting the `OID_TEST_ARGS` environment variable, e.g.:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
OID_TEST_ARGS="-fmy-new-feature" build/test/integration/integration_test_runner
|
||||||
|
OID_TEST_ARGS="-Fold-feature" ctest --test-dir build/test/integration
|
||||||
|
```
|
||||||
|
|
||||||
## Adding tests
|
## Adding tests
|
||||||
|
|
||||||
1. Create a new test definition file in this directory and populate it as needed. See [Test Definition Format](#test-definition-format) for details.
|
1. Create a new test definition file in this directory and populate it as needed. See [Test Definition Format](#test-definition-format) for details.
|
||||||
|
@ -21,14 +21,17 @@ namespace bp = boost::process;
|
|||||||
namespace bpt = boost::property_tree;
|
namespace bpt = boost::property_tree;
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
|
bool run_skipped_tests = false;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
std::string oidExe = OID_EXE_PATH;
|
std::string oidExe = OID_EXE_PATH;
|
||||||
std::string configFile = CONFIG_FILE_PATH;
|
std::string configFile = CONFIG_FILE_PATH;
|
||||||
|
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
bool preserve = false;
|
bool preserve = false;
|
||||||
bool preserve_on_failure = false;
|
bool preserve_on_failure = false;
|
||||||
bool run_skipped_tests = false;
|
std::vector<std::string> global_oid_args{};
|
||||||
std::vector<std::string> extra_feature_args{};
|
|
||||||
|
|
||||||
constexpr static OIOpts cliOpts{
|
constexpr static OIOpts cliOpts{
|
||||||
OIOpt{'h', "help", no_argument, nullptr, "Print this message and exit"},
|
OIOpt{'h', "help", no_argument, nullptr, "Print this message and exit"},
|
||||||
@ -51,9 +54,15 @@ void usage(std::string_view progname) {
|
|||||||
std::cout << cliOpts;
|
std::cout << cliOpts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
|
|
||||||
|
if (const char* envArgs = std::getenv("OID_TEST_ARGS")) {
|
||||||
|
boost::split(global_oid_args, envArgs, boost::is_any_of(" "));
|
||||||
|
}
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
while ((c = getopt_long(argc, argv, cliOpts.shortOpts(), cliOpts.longOpts(),
|
while ((c = getopt_long(argc, argv, cliOpts.shortOpts(), cliOpts.longOpts(),
|
||||||
nullptr)) != -1) {
|
nullptr)) != -1) {
|
||||||
@ -76,7 +85,7 @@ int main(int argc, char* argv[]) {
|
|||||||
oidExe = fs::absolute(optarg);
|
oidExe = fs::absolute(optarg);
|
||||||
break;
|
break;
|
||||||
case '\0':
|
case '\0':
|
||||||
extra_feature_args.push_back(std::string("-f") + optarg);
|
global_oid_args.push_back("-f"s + optarg);
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
default:
|
default:
|
||||||
@ -223,12 +232,12 @@ OidProc OidIntegration::runOidOnProcess(OidOpts opts,
|
|||||||
"--script-source"s, opts.scriptSource,
|
"--script-source"s, opts.scriptSource,
|
||||||
"--pid"s, std::to_string(targetProcess.id()),
|
"--pid"s, std::to_string(targetProcess.id()),
|
||||||
};
|
};
|
||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
// Specify feature args first so they can be overridden by extra_args of
|
// The arguments are appended in ascending order of precedence (low -> high)
|
||||||
// specific tests.
|
std::vector<std::string> oid_args;
|
||||||
auto oid_args = extra_feature_args;
|
oid_args.insert(oid_args.end(), global_oid_args.begin(),
|
||||||
|
global_oid_args.end());
|
||||||
oid_args.insert(oid_args.end(), extra_args.begin(), extra_args.end());
|
oid_args.insert(oid_args.end(), extra_args.begin(), extra_args.end());
|
||||||
oid_args.insert(oid_args.end(), default_args.begin(), default_args.end());
|
oid_args.insert(oid_args.end(), default_args.begin(), default_args.end());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user