Search code examples
prologswi-prologlogtalk

Using Logtalk Timeout function for Testing SWI Prolog Files


This is follow up post associated with Using a Bash Script To Automate Testing of A Prolog File

Now that I have testing effectively implemented, I wish to add timeout values to the tests, so that if a particular case takes too long, the program can move on to the next student's assignment.

When I use logtalk_tester -p swi -t 60, the command successfully runs the tests, but mentions that logtalk will skip the -t 60 timeout flag. My question is, is there a functioning timeout mechanism for logtalk for MacOS Big Sur? The test evaluation is prefixed by the following warning when I run the above command:

enter image description here

I checked the manual page (https://logtalk.org/man/logtalk_tester.html) but as I understand, Windows has a workaround for getting timeout to work, but I do not see mention of MacOS.

Thank you.


Solution

  • The script man pages includes:

    When the script detects either a timeout or a gtimeout command (provided by the GNU coreutils package), it will use it to run each test set if the timeout option is set to a value greater than zero. On Windows operating-systems, the native timeout command is not usable for this purpose.

    You can install the GNU coreutils package easily on macOS using either MacPorts or Homebrew.

    For using individual test specific timeouts (instead of test set timeouts as in your question), see:

    https://logtalk.org/manuals/devtools/lgtunit.html#tests-with-timeout-limits

    P.S. On Windows, the GNU coreutils package is available in the Bash shell provided by the Git for Windows installer.