diff options
author | Daniel Moody <daniel.moody@mongodb.com> | 2023-02-08 21:36:39 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-02-09 08:23:57 +0000 |
commit | 8181de8a415a6198731a7cabe8e04ca014722aa0 (patch) | |
tree | 31f92b6b6d1f215a151d524000664460c0acbf94 | |
parent | 1f2a351adb8ec988beecfbca36196fd0e36214ce (diff) | |
download | mongo-8181de8a415a6198731a7cabe8e04ca014722aa0.tar.gz |
SERVER-72147 defer switching hard coded clang tidy module flags.
-rw-r--r-- | src/mongo/tools/mongo_tidy_checks/SConscript | 10 | ||||
-rw-r--r-- | src/mongo/tools/mongo_tidy_checks/tests/SConscript | 22 |
2 files changed, 19 insertions, 13 deletions
diff --git a/src/mongo/tools/mongo_tidy_checks/SConscript b/src/mongo/tools/mongo_tidy_checks/SConscript index 5947c018f3a..1ff404ae59e 100644 --- a/src/mongo/tools/mongo_tidy_checks/SConscript +++ b/src/mongo/tools/mongo_tidy_checks/SConscript @@ -30,12 +30,10 @@ if not toolchain_found or not toolchain_clang_tidy_dev_found: env = env.Clone() -# TODO SERVER-72147 -# This config was ripped from the toolchain build because our standard build config produced -# mismatched ABI, as well as using z,defs which will not work in this situation, so I am not -# sure what flags were specifically responsible and I just swapped them all. The toolchain build -# should test the check module so that if the configuration of clang-tidy changes there it would -# catch any issues here. +# TODO SERVER-73731 +# Instead of hardcoding these flags, we should load the flags used by the toolchain here +env['CC'] = [f'{base_toolchain_bin}/gcc'] +env['CXX'] = [f'{base_toolchain_bin}/g++'] env['CPPPATH'] = [str(tidy_include)] env['LIBPATH'] = [] env['CCFLAGS'] = [ diff --git a/src/mongo/tools/mongo_tidy_checks/tests/SConscript b/src/mongo/tools/mongo_tidy_checks/tests/SConscript index 7c39431e109..fb9ea385c9f 100644 --- a/src/mongo/tools/mongo_tidy_checks/tests/SConscript +++ b/src/mongo/tools/mongo_tidy_checks/tests/SConscript @@ -9,6 +9,14 @@ import SCons # multiple compilation databases is not supported by ninja if env.GetOption('ninja') == 'disabled': + tidy_test_env = env.Clone() + + # These test files will purposefully be error prone, so we can disable warnings any warnings we expect + # to see. + tidy_test_env.Append(CCFLAGS=[ + '-Wno-unused-but-set-parameter', + ], ) + # This list represents the test source files, which should contain a single issue which will be flagged # by a clang tidy check. The issue should be isolated in as minimal way as possible. tests = [ @@ -23,13 +31,13 @@ if env.GetOption('ninja') == 'disabled': test_objs = [] compilation_dbs = [] for test in tests: - test_env = env.Clone() + test_env = tidy_test_env.Clone() compilation_dbs += test_env.CompilationDatabase( os.path.splitext(os.path.basename(test))[0] + ".json") test_objs += test_env.Object(test) # Building a program binary may not be necessary but it does validate the code and tie it together. - test_prog = env.Program( + test_prog = tidy_test_env.Program( target='MongoTidyCheck_test', source=['MongoTidyCheckTestMain.cpp'] + test_objs, LIBDEPS_NO_INHERIT=[ @@ -39,7 +47,7 @@ if env.GetOption('ninja') == 'disabled': # Here we setup the test execution. The test will pythons built in unittest framework # to execute clang tidy for each test source file from the list above. - test = env.Command( + test = tidy_test_env.Command( target='run_MongoTidyCheck_test', source=[ 'MongoTidyCheck_unittest.py', @@ -52,11 +60,11 @@ if env.GetOption('ninja') == 'disabled': '--clang-tidy-path=${SOURCES[1]}', '--mongo-tidy-module=${SOURCES[2]}', '${["--test-compiledbs=%s" % src for src in SOURCES[3:]]}', - f"{'' if env.Verbose() else '2> /dev/null'}", + f"{'' if tidy_test_env.Verbose() else '2> /dev/null'}", ]), - "" if env.Verbose() else "Runnning mongo tidy checks unittests.", + "" if tidy_test_env.Verbose() else "Runnning mongo tidy checks unittests.", ), ) - env.Alias('+mongo-tidy-tests', test) - env.Depends(test, test_prog) + tidy_test_env.Alias('+mongo-tidy-tests', test) + tidy_test_env.Depends(test, test_prog) |