rt-tests: Add DURATION variable to control test duration

Running the test for 12h is too long in some cases. It would be better if
the duration of the test could be set from outside. With the new environment
variable DURATION a user can control the value of the parameter `-D` of
cyclictest and set the desired value.
This commit is contained in:
Jörg Sommer 2023-06-28 17:55:13 +02:00
parent c1ba82f20a
commit bd2dadcf93
2 changed files with 8 additions and 4 deletions

View File

@ -47,7 +47,7 @@ $ docker run --rm -d --name stress-tests --privileged -v /dev:/dev -v /tmp:/tmp
Check if the stress tests started successfully:
```
$ docker logs stress-tests
$ docker logs stress-tests
Setting up stress tests...
RT stress tests started successfully!
```
@ -61,7 +61,11 @@ Run the following command to execute the `rt-tests` container and start measurin
$ docker run --rm -it --name rt-tests --cap-add=sys_nice --cap-add=ipc_lock --cap-add=sys_rawio --ulimit rtprio=99 --device-cgroup-rule='c 10:* rmw' -v /dev:/dev -v /tmp:/tmp torizon/rt-tests:$CT_TAG_RT_TESTS
```
The tests will run for at most 12 hours, but can be interrupted at any time by pressing CTRL-C.
The tests will run for at most 12 hours, but can be interrupted at any time by
pressing CTRL-C. You can specify a different length of the test run in seconds
by passing the environment variable *DURATION* to the container (with
`-e DURATION=…`); for other units append `m` for minutes, `h` for hours and `d`
for days.
After the tests are finished, stop the `stress-tests` container:
@ -111,4 +115,4 @@ So if you want to run the `rt-tests` container on a non-PREEMPT_RT version of To
```
sudo sh -c "echo 950000 > /sys/fs/cgroup/cpu,cpuacct/docker/cpu.rt_runtime_us"
docker run --rm -it --name rt-tests --cpu-rt-runtime=950000 --cap-add=sys_nice --cap-add=ipc_lock --cap-add=sys_rawio --ulimit rtprio=99 --device-cgroup-rule='c 10:* rmw' -v /dev:/dev -v /tmp:/tmp torizon/rt-tests:$CT_TAG_RT_TESTS
```
```

View File

@ -1,7 +1,7 @@
#!/bin/bash
# Run cyclictest
if ! cyclictest -S -p99 -i1000 -m -D12h -h400 -q >output; then
if ! cyclictest -S -p99 -i1000 -m -D${DURATION:-12h} -h400 -q >output; then
echo "ERROR: cyclictest failed" >&2
exit 1
fi