tests: Fix headers inclusion
commit4f3a97692235ef0e33b4c4be9f70c0e488d85275
authorPetr Písař <petr.pisar@atlas.cz>
Sat, 2 Apr 2022 18:46:44 +0000 (2 20:46 +0200)
committerPetr Písař <petr.pisar@atlas.cz>
Sat, 2 Apr 2022 19:39:01 +0000 (2 21:39 +0200)
tree12f910ae80fba13ca10dfa9849912e93dd15eb68
parent890d63b43a6aac9f9f5bd83c01f2423aa661c716
tests: Fix headers inclusion

Bulding on musl standard library revealed two issues:

(1) A missing header file from server_cli.c:

x86_64-gentoo-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../..  -I/usr/include/libxml2  -I../../src -DSRCDIR=\"../..\" -O2 -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -std=c99 -Wall -c server_cli.c
[...]
server_cli.c: In function 'main':
server_cli.c:91:28: warning: implicit declaration of function 'getopt' [-Wimplicit-function-declaration[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration]]
   91 |     while (-1 != (option = getopt(argc, argv, "h:p:t:u:a:s:S:c:"))) {
      |                            ^~~~~~
server_cli.c:95:28: error: 'optarg' undeclared (first use in this function)
   95 |                 otp_code = optarg;
      |                            ^~~~~~
server_cli.c:95:28: note: each undeclared identifier is reported only once for each function it appears in
server_cli.c:125:9: error: 'optind' undeclared (first use in this function); did you mean 'option'?
  125 |     if (optind != argc) {
      |         ^~~~~~
      |         option

The compilation unit forgot to include <unistd.h>.

(2) Badly named <wait.h> in server.c:

x86_64-gentoo-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../.. -I/usr/include/libxml2 -I../../src -DSRCDIR=\"../..\" -O2 -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -std=c99 -Wall -c server.c  -fPIC -DPIC -o .libs/libserver_la-server.o
[...]
In file included from server.c:26:
/usr/include/wait.h:1:2: warning: #warning redirecting incorrect #include <wait.h> to <sys/wait.h> [-Wcpp[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wcpp]]
    1 | #warning redirecting incorrect #include <wait.h> to <sys/wait.h>
      |  ^~~~~~~

The compilation unit misnamed <sys/wait.h>.

This patch fixes both these issues.

https://bugs.gentoo.org/show_bug.cgi?id=836628
test/simline/server.c
test/simline/server_cli.c