File tree Expand file tree Collapse file tree 4 files changed +25
-3
lines changed Expand file tree Collapse file tree 4 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ simulator = static_library('simulator',
41
41
' cosy.cpp' ,
42
42
],
43
43
cpp_args : [
44
+ ' -Werror' ,
44
45
' -Wshadow' ,
45
46
' -DVERSION_STRING="' + meson .project_version() + ' .' + revcount + ' -' + hash + ' "'
46
47
]
@@ -69,5 +70,23 @@ install_data([
69
70
install_mode : ' r--r--r--' ,
70
71
)
71
72
73
+ #
74
+ # Run cppcheck
75
+ #
76
+ run_target (' cppcheck' , command : [
77
+ ' cppcheck' ,
78
+ ' --project=' + join_paths (meson .project_build_root(), ' compile_commands.json' ),
79
+ ' --std=c++17' ,
80
+ ' --enable=style' ,
81
+ ' --check-level=exhaustive' ,
82
+ ' --error-exitcode=1' , # Fail on any issues
83
+ ' --inline-suppr' , # Enable inline control like // cppcheck-suppress 'id'
84
+ ' --quiet' , # No progress report messages
85
+ ' --suppress=badBitmaskCheck' , # Allow redundant zero operands
86
+ ' --suppress=*:*/gtest/*' , # Ignore issues in Googletest
87
+ ' --library=' + join_paths (meson .source_root(), ' tests/googletest.xml' ), # Parse TEST() macro properly
88
+ ]
89
+ )
90
+
72
91
# Tests are defined in 'tests/meson.build' file
73
92
subdir (' tests' )
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ TEST(cli, trace_end_file)
102
102
auto trace = file_contents_split (trace_filename);
103
103
104
104
// Check output.
105
- ASSERT_GE (trace.size (), 4 );
105
+ ASSERT_GE (trace.size (), 4u );
106
106
EXPECT_TRUE (starts_with (trace[0 ], " Dubna Simulator Version" ));
107
107
EXPECT_STREQ (trace[1 ].c_str (), " 02010 R: 00 070 3002 *70 3002" );
108
108
EXPECT_STREQ (trace[2 ].c_str (), " Drum 21 PhysRead [00000-00377] = Zone 1 Sector 2" );
Original file line number Diff line number Diff line change @@ -96,7 +96,9 @@ class dubna_machine : public ::testing::Test {
96
96
void test_cernlib (unsigned lib_num, const std::string &file_base)
97
97
{
98
98
std::string job_filename = get_test_name () + " .dub" ;
99
- std::string input_dir = (lib_num == 1 ) ? (TEST_DIR " /lib1/" ) : (TEST_DIR " /lib2/" );
99
+ std::string lib1_dir = std::string (TEST_DIR " /lib1/" );
100
+ std::string lib2_dir = std::string (TEST_DIR " /lib2/" );
101
+ std::string input_dir = (lib_num == 1 ) ? lib1_dir : lib2_dir;
100
102
std::string input_filename = input_dir + file_base + " .f" ;
101
103
std::string expect_filename = input_dir + " /expect_" + file_base + " .txt" ;
102
104
std::string prolog = " *name " + file_base + " \n " +
Original file line number Diff line number Diff line change @@ -24,9 +24,10 @@ unit_tests = executable('unit_tests',
24
24
include_directories : ' ..' ,
25
25
link_with : simulator,
26
26
cpp_args : [
27
+ ' -Werror' ,
27
28
' -Wshadow' ,
28
29
' -DTEST_DIR="' + meson .current_source_dir() + ' "' ,
29
- ' -DBUILD_DIR="' + meson .build_root () + ' "' ,
30
+ ' -DBUILD_DIR="' + meson .project_build_root () + ' "' ,
30
31
],
31
32
build_by_default : false
32
33
)
You can’t perform that action at this time.
0 commit comments