Commit Graph

36 Commits

Author SHA1 Message Date
Sylvain Joubert
ca2a84c3d7 TestDriver: Fix 'misc-use-anonymous-namespace' warning from clang-tidy 16
C++ best practices recommend using anonymous namespace instead of a global
static qualifier.
2023-04-25 12:54:31 +02:00
Sean McBride
1cf14f8c03 Source: fix many -Wmissing-prototypes warnings by marking functions static 2021-10-25 12:27:09 -04:00
Sylvain Joubert
ba54092842 TestDriver: Fix old-style-cast warning in C++ mode
A C-style cast was added by commit 3f6ff4b5db (create_test_sourcelist:
add test driver option to run all tests, 2021-04-27, v3.21.0-rc1~257^2).
Use our `CM_CAST` macro to adapt based on the language.
2021-10-04 11:00:12 -04:00
Ben Boeckel
0bb3d457cb TestDriver: use CM_NULL to avoid lints about nullptr usage 2021-07-14 19:53:54 -04:00
Ben Boeckel
32ff836e2a TestDriver: suppress deprecated header lints for time.h
Similar to the other includes, this one should be suppressed as well.
2021-07-14 16:47:16 -04:00
Brad King
1e3d3c5284 TestDriver: Avoid declaring local variable after statement
Move a declaration added by commit 3f6ff4b5db (create_test_sourcelist:
add test driver option to run all tests, 2021-04-27, v3.21.0-rc1~257^2)
into its own scope.
2021-06-28 09:28:15 -04:00
Sergey Bronnikov
3f6ff4b5db create_test_sourcelist: add test driver option to run all tests
New option `-A` passed to test binary allows to run all testcases at
once and prints a report in a standard format - TestAnythingProtocol v.13 [1].
Execution of test whose names will be passed after an option will be skipped.

Sample of output:

    TAP version 13
    1..6
    ok 1 TestCryptoHash # 0.030000
    ok 2 TestCryptoRand # 0.008000
    not ok 3 TestCryptoCipher # 0.005000
    ok 4 TestCryptoProtectData # 0.000000
    cbPlainText: 21 cbCipherText: 32
    PlainText: MySecretPassword123! (cbPlainText = 21, cbCipherText = 32)
    Decrypted CipherText: MySecretPassword123!
    ok 5 TestCryptoProtectMemory # 0.014000
    ok 6 TestCryptoCertEnumCertificatesInStore # 0.000000

1. https://testanything.org/

Fixes: #19367
2021-04-28 09:28:25 -04:00
Sergey Bronnikov
0273293047 create_test_sourcelist: fix typo in placeholder name
Rename `CMAKE_FUNCTION_TABLE_{ENTIRES => ENTRIES}`.
2020-12-21 13:45:12 -05:00
Ben Boeckel
b108c9fdaf TestDriver: avoid clang-tidy lints in generated code 2020-04-13 11:26:02 -04:00
Ben Boeckel
677097ac1d TestDriver: ignore strcpy call
clang-analyzer has a check for any use of `strcpy`. This usage is safe
because it is allocated above using the length of the string.
2019-12-05 14:24:34 -05:00
Sean McBride
1d0d4167cf TestDriver: Fix -Wzero-as-null-pointer-constant warnings 2019-09-18 14:05:39 -04:00
Brad King
5ba76299f8 Merge topic 'nolint_typedef_testdriver'
bbbcbb1a48 TestDriver: Disable clang-tidy 'modernize-use-using'

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2118
2018-06-01 09:48:51 -04:00
Sylvain Joubert
bbbcbb1a48 TestDriver: Disable clang-tidy 'modernize-use-using' 2018-05-31 13:51:40 +02:00
Sander Vrijders
3af0438b4b TestDriver: Replace strncpy with strcpy
GCC 8.1.0 now gives an error if `strncpy` is called with a bound
depending on the length of the source argument.  Replace `strncpy` with
`strcpy` as the length is known a priori.

Fixes: #18038
2018-05-30 09:45:57 -04:00
Sylvain Joubert
72d3161a7f TestDriver: fix style-'variableScope' cppcheck warning
When applied on a user project, cppcheck complains that the 'test_name'
variable could have a reduced scope.
2017-11-22 19:54:00 +01:00
Brad King
221ffabfad TestDriver: Fix -Wconversion warning
Since commit v3.8.0-rc1~51^2~1 (TestDriver: calc NumTests at compile
time, 2017-01-24) we convert an expression that uses `sizeof()` to an
`int` as a compile-time constant.  Some GCC versions warn about this
with `-Wconversion`.  Add a cast to avoid the warning.
2017-07-14 08:01:26 -04:00
Brad King
608cc887c7 TestDriver: Remove unused local variable initialization 2017-05-10 10:01:15 -04:00
Daniel Pfeifer
eb86b4cec1 TestDriver: fix/silence clang-tidy warnings 2017-01-24 22:24:06 +01:00
Daniel Pfeifer
178c897374 TestDriver: calc NumTests at compile time 2017-01-24 22:24:06 +01:00
Daniel Pfeifer
3bb4a79826 TestDriver: use for loop 2017-01-24 22:24:06 +01:00
Daniel Pfeifer
60b68304f2 TestDriver: abstract CM_CAST macro 2017-01-24 22:24:06 +01:00
Daniel Pfeifer
1731b90cd0 TestDriver: Revise C++ coding style using clang-format 2017-01-24 22:24:06 +01:00
Sylvain Joubert
cd344e3a62 create_test_sourcelist: Use safer strncpy instead of strcpy
Clang-tidy advises to use a safer function in place of strcpy.
This should avoid such warnings in user build using clang-tidy.
2016-08-25 10:56:50 -04:00
Brad King
63fc8dcdb8 create_test_sourcelist: Suppress MSVC warnings in test driver (#15066)
Suggested-by: Ken Moreland <kmorel@sandia.gov>
2014-08-07 09:17:44 -04:00
Sean McBride
50ca77f4a0 create_test_sourcelist: Initialize variable at declaration
Clang -Wconditional-uninitialized warns otherwise.
2014-03-31 09:41:05 -04:00
Sean McBride
ed675a92a1 create_test_sourcelist: Fix linkage in generated test driver code
Mark private function/global with static linkage.
2013-11-12 09:27:11 -05:00
Matt McCormick
7eddefd8f1 TestDriver.cxx.in: Untrusted array index read.
As reported by Coverity Scan, if the configured file contains a #include,

  Untrusted array index read
  The array index could be controlled by an attacker, leading to reads outside
  the bounds of the array.
  In main: Read from array at index computed using an unscrutinized value from
  an untrusted source (CWE-129)

  CID 1081283 (#1 of 1): Untrusted array index read (TAINTED_SCALAR)
  25. tainted_data: Using tainted variable "testToRun" as an index into an array
  "cmakeGeneratedFunctionMapEntries".
2013-10-16 10:11:20 +00:00
Kitware Robot
7bbaa4283d Remove trailing whitespace from most CMake and C/C++ code
Our Git commit hooks disallow modification or addition of lines with
trailing whitespace.  Wipe out all remnants of trailing whitespace
everywhere except third-party code.

Run the following shell code:

git ls-files -z -- \
 bootstrap doxygen.config '*.readme' \
 '*.c' '*.cmake' '*.cpp' '*.cxx' \
 '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \
 '*.mm' '*.pike' '*.py' '*.txt' '*.vim' |
egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' |
egrep -z -v '^(Modules/CPack\..*\.in)' |
xargs -0 sed -i 's/ \+$//'
2012-08-13 14:18:39 -04:00
David Cole
95a6feaa66 COMP: Don't emit old style cast warning when configured as C++ but still allow being configured as C. Thanks to Monsieur Francois Bertel for the patch. 2008-12-09 10:56:41 -05:00
Amitha Perera
47aa926523 BUG: the return value of scanf should not be ignored 2008-11-25 09:52:21 -05:00
Bill Hoffman
ff7757e34c make sure tests flush output 2004-07-16 15:18:42 -04:00
Bill Hoffman
a613100b1e BUG: remove debug pop hacks, also remove duplicate call to argvc function 2004-05-08 14:55:07 -04:00
Ken Martin
c10cb4db5a fix warning maybe 2004-05-07 08:35:46 -04:00
Ken Martin
f299f4ae9c fix warning 2004-05-06 08:51:36 -04:00
Bill Hoffman
7eab2e4235 ENH: remove unused variable 2004-04-30 11:36:01 -04:00
Bill Hoffman
e539cf9f7c ENH: make test driver more flexible by using a configured file instead of generating all the code. fixes bug 28 2004-04-28 12:31:18 -04:00