aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-04-07 01:27:21 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-04-07 01:27:21 +0300
commitc6e99acef81208ae679fe4234b6b35e111f91789 (patch)
tree561d96103ad4d1ab5e198ced939935bc62b18170
parentctest-driver.py: add --fail-regex, fix --pass-regex (diff)
downloadcmake-common-c6e99acef81208ae679fe4234b6b35e111f91789.tar.gz
cmake-common-c6e99acef81208ae679fe4234b6b35e111f91789.zip
tools: update usage information, add docs/ entries
-rw-r--r--README.md12
-rw-r--r--docs/clang-format.md5
-rw-r--r--docs/ctest-driver.md13
-rwxr-xr-xtools/clang-format.py4
-rwxr-xr-xtools/ctest-driver.py4
5 files changed, 29 insertions, 9 deletions
diff --git a/README.md b/README.md
index 23e100f..0e685ff 100644
--- a/README.md
+++ b/README.md
@@ -142,13 +142,15 @@ for configuration in Debug Release; do
done
```
-### clang-format.py
+Tools
+-----
-`clang-format` all C/C++ files in a project.
+* [clang-format.py] &mdash; `clang-format` all C/C++ files in the project.
+* [ctest-driver.py] &mdash; wrap an executable for testing with CTest;
+cross-platform `grep`.
- $ cd project/
- $ python3 path/to/tools/clang-format.py # Prints a diff
- $ python3 path/to/tools/clang-format.py -i # Edits files in-place
+[clang-format.py]: docs/clang-format.md
+[ctest-driver.py]: docs/ctest-driver.md
Examples
--------
diff --git a/docs/clang-format.md b/docs/clang-format.md
new file mode 100644
index 0000000..217b2da
--- /dev/null
+++ b/docs/clang-format.md
@@ -0,0 +1,5 @@
+`clang-format` all C/C++ files in the project.
+
+ $ cd project/
+ $ python3 path/to/tools/clang-format.py # Prints a diff
+ $ python3 path/to/tools/clang-format.py -i # Edits files in-place
diff --git a/docs/ctest-driver.md b/docs/ctest-driver.md
new file mode 100644
index 0000000..af7c3b2
--- /dev/null
+++ b/docs/ctest-driver.md
@@ -0,0 +1,13 @@
+CTest suffers from at least two issues, in particular with regard to its
+PASS_REGULAR_EXPRESSION feature:
+
+1. The regular expression syntax used by CMake is deficient.
+2. The exit code of a test is ignored if one of the regexes matches.
+
+`ctest-driver.py` tries to fix them.
+
+ $ python3 path/to/tools/ctest-driver.py run --pass-regex OK --fail-regex Fail -- path/to/executable arg1 arg2
+
+In addition, it's a cross-platform `grep`:
+
+ $ python3 path/to/tools/ctest-driver.py grep --pass-regex OK --fail-regex Fail -- path/to/logfile.log
diff --git a/tools/clang-format.py b/tools/clang-format.py
index 01cdae5..81b2f93 100755
--- a/tools/clang-format.py
+++ b/tools/clang-format.py
@@ -5,9 +5,9 @@
# For details, see https://github.com/egor-tensin/cmake-common.
# Distributed under the MIT License.
-'''Feed C/C++ files in the repository to clang-format
+'''clang-format all C/C++ files in the project
-This script runs clang-format on every C/C++ file in the repository, either
+This script feeds every C/C++ file in the repository to clang-format, either
printing a unified diff between the original and the formatted versions, or
formatting the files in-place.
'''
diff --git a/tools/ctest-driver.py b/tools/ctest-driver.py
index c5f9194..414e20c 100755
--- a/tools/ctest-driver.py
+++ b/tools/ctest-driver.py
@@ -5,12 +5,12 @@
# For details, see https://github.com/egor-tensin/cmake-common.
# Distributed under the MIT License.
-'''Wrap your actual test driver for CTest
+'''Wrap your actual test driver to use with CTest
CTest suffers from at least two issues, in particular with regard to its
PASS_REGULAR_EXPRESSION feature:
-1. The regular expression syntax is deficient.
+1. The regular expression syntax used by CMake is deficient.
2. The exit code of a test is ignored if one of the regexes matches.
This script tries to fix them.