tests: Correct use of taskset in snapshot tests
Observed issue
==============
While investigating potential changes to how buffers are flushed
during snapshots, I discovered that the changes made the small
overwrite test flaky.
After investigation, the issue appears to be a problem with the test
that was exposed by the other changes.
Cause
=====
`taskset` handles its arguments more strictly than many other CLI
programs, and the argument order used is not valid. As the return
of the taskset invocation in the test isn't validated, there was
little indication of the issue save a warning that is easily lost
in the text.
The following example demonstrates the situation:
```
$ bash -x test.sh
+ taskset -p 910843
pid 910843's current affinity mask: f
+ echo 0
0
+ ./tests/utils/testapp/gen-ust-events/gen-ust-events
Process 910845 has 4 cpus in its affinity set
CPU 0 is set? 1
CPU 1 is set? 1
CPU 2 is set? 1
CPU 3 is set? 1
+ taskset -c 0 -p 910843
taskset: failed to execute -p: No such file or directory
+ echo 127
127
+ ./tests/utils/testapp/gen-ust-events/gen-ust-events
Process 910849 has 4 cpus in its affinity set
CPU 0 is set? 1
CPU 1 is set? 1
CPU 2 is set? 1
CPU 3 is set? 1
+ taskset -pc 0 910843
pid 910843's current affinity list: 0-3
pid 910843's new affinity list: 0
+ echo 0
0
+ ./tests/utils/testapp/gen-ust-events/gen-ust-events
Process 910853 has 1 cpus in its affinity set
CPU 0 is set? 1
```
Solution
========
Correct the invocation of taskset and add a check on its return code
when used to set the cpu affinity of the current process.
Known drawbacks
===============
None.
Change-Id: Ia629121624532746431875b2031dd65df207666d
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.026671 seconds and 4 git commands to generate.