]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Added comments for cmake test scripts.
authorNathan Moinvaziri <nathan@nathanm.com>
Tue, 16 Mar 2021 05:05:58 +0000 (22:05 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Tue, 16 Mar 2021 15:00:00 +0000 (16:00 +0100)
cmake/run-and-compare.cmake
cmake/run-and-redirect.cmake
cmake/test-compress.cmake

index 0e934337314f3c25c96e4762e0d4e609b0774e69..d64005204aae09a816b2067a358aab5a80f14bfe 100644 (file)
@@ -1,3 +1,17 @@
+# run-and-compare.cmake -- Runs a command and compares its output to an expected value
+
+# Copyright (C) 2021 Nathan Moinvaziri
+# Licensed under the Zlib license, see LICENSE.md for details
+
+# Required Variables
+#   COMMAND             - Command to run
+#   OUTPUT              - Standard output
+#   COMPARE             - String to compare output against
+
+# Optional Variables
+#   INPUT               - Standard intput
+#   IGNORE_LINE_ENDINGS - Ignore line endings when comparing output
+
 if(NOT DEFINED OUTPUT OR NOT DEFINED COMPARE OR NOT DEFINED COMMAND)
     message(FATAL_ERROR "Run and compare arguments missing")
 endif()
index 30c5741121cce6af50037a73007c0cdb2a51147a..29f8a33e61d72f1fc610f727ec38a2bf9ea2a09f 100644 (file)
@@ -1,3 +1,19 @@
+# run-and-redirect.cmake -- Runs a command and validates exit code
+
+# Copyright (C) 2021 Nathan Moinvaziri
+# Licensed under the Zlib license, see LICENSE.md for details
+
+# Normally ctest will always fail with non-zero exit code, but we have tests
+# that need to check specific exit codes.
+
+# Required Variables
+#   COMMAND      - Command to run
+
+# Optional Variables
+#   INPUT        - Standard intput
+#   OUTPUT       - Standard output (default: /dev/null)
+#   SUCCESS_EXIT - List of successful exit codes (default: 0, ie: 0;1)
+
 # If no output is specified, discard output
 if(NOT DEFINED OUTPUT)
     if(WIN32)
index 75355bc73776fae1eea6e25e8c1d45df904ecd6f..833aa3fc0e0ae1835d99972bf3b3d230e66fb937 100644 (file)
@@ -1,3 +1,28 @@
+# test-compress.cmake -- Runs a test against an input file to make sure that the specified
+#   targets are able to to compress and then decompress it successfully. Optionally verify
+#   the results with gzip. Output files are generated with unique names to prevent parallel
+#   tests from corrupting one another. Default target arguments are compatible with minigzip.
+
+# Copyright (C) 2021 Nathan Moinvaziri
+# Licensed under the Zlib license, see LICENSE.md for details
+
+# that test a specific input file for compression or decompression.
+
+# Required Variables
+#   INPUT                   - Input file to test
+#   TARGET or               - Command to run for both compress and decompress
+#     COMPRESS_TARGET and   - Command to run to compress input file
+#     DECOMPRESS_TARGET     - Command to run to decompress output file
+
+# Optional Variables
+#   COMPRESS_ARGS           - Arguments to pass for compress command (default: -c -k)
+#   DECOMPRESS_ARGS         - Arguments to pass to decompress command (default: -d -c)
+
+#   GZIP_VERIFY             - Verify that gzip can decompress the COMPRESS_TARGET output and
+#                             verify that DECOMPRESS_TARGET can decompress gzip output of INPUT
+#   COMPARE                 - Verify decompressed output is the same as input
+#   SUCCESS_EXIT            - List of successful exit codes (default: 0, ie: 0;1)
+
 if(TARGET)
     set(COMPRESS_TARGET ${TARGET})
     set(DECOMPRESS_TARGET ${TARGET})
@@ -157,7 +182,7 @@ if(GZIP_VERIFY AND NOT "${COMPRESS_ARGS}" MATCHES "-T")
             message(FATAL_ERROR "Cannot find minigzip decompress input: ${OUTPUT}.gzip.gz")
         endif()
 
-        # Check minigzip can decompress gzip compressed output
+        # Check decompress target can handle gzip compressed output
         execute_process(COMMAND ${CMAKE_COMMAND}
             "-DCOMMAND=${DECOMPRESS_COMMAND}"
             -DINPUT=${OUTPUT}.gzip.gz