adding test ioctl

Eugene Syromiatnikov esyr at redhat.com
Mon Mar 2 20:32:10 UTC 2020


On Mon, Mar 02, 2020 at 10:32:04AM +0530, Bran S wrote:
> I have written a small ioctl test for microproject.
> Here: https://paste.debian.net/1132971/
> 
> Next:
> 1. Edit the Makefile.am, where should I mention the new test ? I don't see
> all the tests in check_PROGRAMS variable. And I am not sure what it does.

It lists all the test binary targets that have to be listed explicitly.
There is also a way for implicit binary target definition,
PURE_EXECUTABLES, that is defined in the sourced pure_executables.am,
generated from pure_executables.list (see tests/gen_pure_executables.sh
for the reference).

> Please clarify what needs to be done in Makefile.am.

Depends on what you are doing.  If your binary falls under "pure
executable" definition (that is, an executable without side effects that
can be run multiple times in parallel, and doesn't require specific
environment/arguments to run), then it can be listed in
pure_executable.lists, and the respective target will be added to the
PURE_EXECUTABLES variable automatically; otherwise, just add it to
check_PORGRAMS manually, so the appropriate build rule will be
generated.

> 2. Create ioctl_xyz.dir/exp

"exp" files are generated during the test run (usually, by
run_strace_match_* functions or the test itself); if you want to provide
the expected output explicitly, please take a look at the *.expected
files and the way they are handled.  However, I doubt that, judging
by the way your test case is written.

> 3. Edit gen_tests.in

If your test can be generated (which is likely the case, unless some
specific setup is needed), that's the way to go, yes.

> Do I need to make any other changes ? or is there anything I have missed to
> mention.

tests/.gitignore should include the test binary name.

You may probably want to have a look at [1] as a possible new ioctl
implementation example.

[1] https://gitlab.com/strace/strace/commit/7adb5a2f9e3e



More information about the Strace-devel mailing list