File: Testing.md

package info (click to toggle)
swi-prolog 9.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 82,408 kB
  • sloc: ansic: 387,503; perl: 359,326; cpp: 6,613; lisp: 6,247; java: 5,540; sh: 3,147; javascript: 2,668; python: 1,900; ruby: 1,594; yacc: 845; makefile: 428; xml: 317; sed: 12; sql: 6
file content (58 lines) | stat: -rw-r--r-- 2,163 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Testing SWI-Prolog

By  default  the  `cmake`  configuration  is   setup  to  build  a  test
configuration for `ctest`. The tests are  designed to allow for parallel
execution. The normal way to run them is   like  this. The `-j 8` runs 8
tests concurrently. At the time of writing,   using more than 16 jobs is
useless because some of the tests take long.  A good value is the number
of cores you have, maximizing at 16 or   something  lower if you want to
limit resource usage.

    ctest -j 8 --output-on-failure

These  defaults  can  be  set  using   these  environment  variables  in
`~/.bashrc`:

    export CTEST_PARALLEL_LEVEL=8
    export CTEST_OUTPUT_ON_FAILURE=y


## Network testing

Most of the network testing is done   by  creating multiple threads that
run both the server and client  in   one  process. This does require the
test suite to open network ports,   but  only requires localhost access.
There  are  also  some  tests  that  test  access  to  public  networks,
contacting  https://www.swi-prolog.org.  As  some    testing  containers
disallow public network access, these tests are disabled by default.  To
enable them set the variable `SWIPL_PUBLIC_NETWORK_TESTS` to `true`:

    SWIPL_PUBLIC_NETWORK_TESTS=true ctest

or in `~/.bashrc`:

    export SWIPL_PUBLIC_NETWORK_TESTS=true


## Testing the installed system

In some scenarios one  wishes  to   test  in  the deployment environment
rather than the build environment.  This   feature  was  added for cross
compiling SWI-Prolog, a condition  that  makes   testing  in  the  build
environment impossible. Testing in a   compatible (in theory) deployment
environment is another use case.

This is facilitated by running `cmake` as

    cmake -DINSTALL_TESTS=ON ...

Installing the system adds a subdirectory  `test` to the SWI-Prolog home
directory, containing about 12Mb  (at  the   time  of  writing)  of test
scripts and data.  To run the test, start Prolog and run

    ?- test_installation.

Scripts may wish to do  so   non-interactively  like below. This command
exits with status 0 on success and non-zero if some test(s) failed.

    swipl -g test_installation -t halt