From: Kevin Day Date: Wed, 23 Apr 2025 03:45:50 +0000 (-0500) Subject: Update: Add higher level testfile. X-Git-Tag: 0.7.1~4 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=aaf0aa4073cf10ffde2dfa67cf39c019f92f7deb;p=kevux-tools Update: Add higher level testfile. Previously, something like the following is needed to perform the "remove" program runtime unit tests: ``` fake -w /tmp/fll-0.7/ clean make -f testfile -U build/remove ``` This new `testfile` allows for shortening the command to: ``` fake -w /tmp/fll-0.7/ clean make -f testfile ``` Note tat the `-w /tmp/fll-0.7/` is an example use-case for where I am storing the work directory files. The command can be simplified to just the following (given a clean source directory and proper system installation of dependencies): ``` fake -f testfile ``` --- diff --git a/data/build/remove/testfile b/data/build/remove/testfile index 9397d82..8eebc92 100644 --- a/data/build/remove/testfile +++ b/data/build/remove/testfile @@ -2,8 +2,6 @@ # # Performs runtime testing, which includes building the program. # -# To keep things simple, this only runs tests against fss_read. -# settings: load_build yes diff --git a/data/build/testfile b/data/build/testfile new file mode 100644 index 0000000..4536921 --- /dev/null +++ b/data/build/testfile @@ -0,0 +1,80 @@ +# fss-0005 iki-0002 +# +# Performs runtime testing, which includes building the program. +# + +settings: + load_build no + fail exit + + environment PATH LD_LIBRARY_PATH + environment LANG LC_ALL LC_COLLATE LC_CTYPE LC_FASTMSG LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LOCPATH NLSPATH + environment CMOCKA_XML_FILE CMOCKA_MESSAGE_OUTPUT CMOCKA_TEST_ABORT + + # Cmocka is not fully thread-safe, set this to "1" to have cmocka call abort() on a test failure. + #define CMOCKA_TEST_ABORT 1 + + # One of: STDOUT, SUBUNIT, TAP, or XML. + #define CMOCKA_MESSAGE_OUTPUT STDOUT + + # When in "XML" output mode, output to this file rather than stdout. + #define CMOCKA_XML_FILE ./out.xml + +main: + operate remove + +remove: + build remove/settings-objects + build remove/settings-mocks.remove + build remove/settings-tests.remove + + operate build_path + operate ld_library_path + + if exist parameter:"build_path"programs/shared/test-remove + shell parameter:"build_path"programs/shared/test-remove + + if exist parameter:"build_path"programs/static/test-remove + shell parameter:"build_path"programs/static/test-remove + + if not exist parameter:"build_path"programs/shared/test-remove + and not exist parameter:"build_path"programs/static/test-remove + operate not_created + +not_created: + print + print 'context:"error"Failed to test due to being unable to find either a shared or static test binary to perform tests.[context]:"reset"' + + exit failure + +build_path: + parameter build_path build/ + + if parameter build:value + parameter build_path parameter:"build:value" + +ld_library_path: + if define LD_LIBRARY_PATH + and parameter work:value + define LD_LIBRARY_PATH 'parameter:"build_path"libraries/shared:parameter:"work:value"libraries/shared:define:"LD_LIBRARY_PATH"' + + else + if define LD_LIBRARY_PATH + define LD_LIBRARY_PATH 'parameter:"build_path"libraries/shared:define:"LD_LIBRARY_PATH"' + + else + if parameter work:value + define LD_LIBRARY_PATH 'parameter:"build_path"libraries/shared:parameter:"work:value"libraries/shared' + + else + define LD_LIBRARY_PATH 'parameter:"build_path"libraries/shared' + +help: + print + print context:'title'Fakefile Options for Kevux Tools Remove Software Testing.context:'reset' + print + + print + print The following operations are available\: + print " - context:'notable'help:context:'reset' Perform the help operation, printing this message." + print " - context:'notable'main:context:'reset' Build the and run the tests."