]> Kevux Git Server - kevux-tools/commitdiff
Update: Add higher level testfile.
authorKevin Day <Kevin@kevux.org>
Wed, 23 Apr 2025 03:45:50 +0000 (22:45 -0500)
committerKevin Day <Kevin@kevux.org>
Wed, 23 Apr 2025 03:48:32 +0000 (22:48 -0500)
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
```

data/build/remove/testfile
data/build/testfile [new file with mode: 0644]

index 9397d82f9669fcd8e0ce74dcf933d934ee0f3b2c..8eebc9280fa6d8c0655fde0c45bd506a88d65439 100644 (file)
@@ -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 (file)
index 0000000..4536921
--- /dev/null
@@ -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."