Skip to content

Commit

Permalink
ci: install llvm; use JSON matrix for testing; test leak sanitizer
Browse files Browse the repository at this point in the history
  • Loading branch information
c-dilks committed Feb 16, 2024
1 parent 964c4a7 commit 0a56270
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 27 deletions.
3 changes: 2 additions & 1 deletion .github/install-dependency-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ GENERAL_PACKAGE_LIST_LINUX=(
pkgconf
ninja
meson
gcovr # for coverage
gcovr # for coverage
python-pygments # for coverage report syntax colors
llvm # for `llvm-symbolizer`, for human-readable sanitizer results
)
IGUANA_PACKAGE_LIST_LINUX=(
fmt
Expand Down
50 changes: 35 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,40 @@ on:
required: false
type: string
default: 'latest'
test_matrix:
description: 'Test matrix for `test_iguana` job (JSON)'
required: false
type: string
default: >-
{
"include": [
{ "mode": "coverage", "CC": "gcc", "CXX": "g++", "buildtype": "release" },
{ "mode": "san_address", "CC": "clang", "CXX": "clang++", "buildtype": "debug" },
{ "mode": "san_thread", "CC": "clang", "CXX": "clang++", "buildtype": "debug" },
{ "mode": "san_undefined", "CC": "clang", "CXX": "clang++", "buildtype": "debug" },
{ "mode": "san_memory", "CC": "clang", "CXX": "clang++", "buildtype": "debug" },
{ "mode": "san_leak", "CC": "clang", "CXX": "clang++", "buildtype": "debug" }
]
}
# default: >-
# {
# "mode": [
# "coverage",
# "san_address",
# "san_thread",
# "san_undefined",
# "san_memory",
# "san_leak"
# ],
# "include": [
# { "mode": "coverage", "CC": "gcc", "CXX": "g++", "buildtype": "release" },
# { "mode": "san_address", "CC": "clang", "CXX": "clang++", "buildtype": "debug" },
# { "mode": "san_thread", "CC": "clang", "CXX": "clang++", "buildtype": "debug" },
# { "mode": "san_undefined", "CC": "clang", "CXX": "clang++", "buildtype": "debug" },
# { "mode": "san_memory", "CC": "clang", "CXX": "clang++", "buildtype": "debug" },
# { "mode": "san_leak", "CC": "clang", "CXX": "clang++", "buildtype": "debug" }
# ]
# }

defaults:
run:
Expand Down Expand Up @@ -205,21 +239,7 @@ jobs:
image: ${{ inputs.container }}
strategy:
fail-fast: false
matrix:
mode:
- coverage
- san_address
- san_thread
- san_undefined
# - san_memory # FIXME: not sure how to get meaningful stack traces
- san_leak
include:
- { mode: coverage, CC: gcc, CXX: g++, buildtype: release }
- { mode: san_address, CC: clang, CXX: clang++, buildtype: debug }
- { mode: san_thread, CC: clang, CXX: clang++, buildtype: debug }
- { mode: san_undefined, CC: clang, CXX: clang++, buildtype: debug }
# - { mode: san_memory, CC: clang, CXX: clang++, buildtype: debug }
- { mode: san_leak, CC: clang, CXX: clang++, buildtype: debug }
matrix: ${{ fromJson(inputs.test_matrix) }}
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
Expand Down
1 change: 1 addition & 0 deletions src/iguana/algorithms/clas12/LorentzTransformer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace iguana::clas12 {


void LorentzTransformer::Run(hipo::banklist& banks) const {
auto leak = new Object("leak");
auto& particleBank = GetBank(banks, b_particle, "REC::Particle");
ShowBank(particleBank, Logger::Header("INPUT PARTICLES"));
for(int row = 0; row < particleBank.getRows(); row++) {
Expand Down
27 changes: 16 additions & 11 deletions src/iguana/tests/iguana-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ int main(int argc, char **argv) {
const int num_events = std::stoi(argv[2]);
const std::string algo_name = std::string(argv[3]);
std::vector<std::string> bank_names;
bool verbose = false;
for(int i=4; i<argc; i++)
bank_names.push_back(std::string(argv[i]));
fmt::print("TEST IGUANA:\n");
fmt::print(" {:>20} = {}\n", "data_file", data_file);
fmt::print(" {:>20} = {}\n", "num_events", num_events);
fmt::print(" {:>20} = {}\n", "algo_name", algo_name);
fmt::print(" {:>20} = {}\n", "banks", fmt::join(bank_names,", "));
fmt::print("\n");
if(verbose) {
fmt::print("TEST IGUANA:\n");
fmt::print(" {:>20} = {}\n", "data_file", data_file);
fmt::print(" {:>20} = {}\n", "num_events", num_events);
fmt::print(" {:>20} = {}\n", "algo_name", algo_name);
fmt::print(" {:>20} = {}\n", "banks", fmt::join(bank_names,", "));
fmt::print("\n");
}

// open the HIPO file; we use 2 readers, one for 'before' (i.e., not passed through iguana), and one for 'after'
// (passed through iguana), so we may compare them
Expand All @@ -44,11 +47,13 @@ int main(int argc, char **argv) {
// run the algorithm
seq.Run(banks_after);
// print the banks, before and after
for(decltype(bank_names)::size_type it_bank=0; it_bank < bank_names.size(); it_bank++) {
fmt::print("{:=^70}\n", fmt::format(" BEFORE: {} ", bank_names.at(it_bank)));
banks_before.at(it_bank).show();
fmt::print("{:=^70}\n", fmt::format(" AFTER: {} ", bank_names.at(it_bank)));
banks_after.at(it_bank).show();
if(verbose) {
for(decltype(bank_names)::size_type it_bank=0; it_bank < bank_names.size(); it_bank++) {
fmt::print("{:=^70}\n", fmt::format(" BEFORE: {} ", bank_names.at(it_bank)));
banks_before.at(it_bank).show();
fmt::print("{:=^70}\n", fmt::format(" AFTER: {} ", bank_names.at(it_bank)));
banks_after.at(it_bank).show();
}
}
}

Expand Down

0 comments on commit 0a56270

Please sign in to comment.