tests: Fix headers inclusion
commit1d5a71656432e9a55cfd2d9662cccf2e31ce1d52
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:53:07 +0000 (2 21:53 +0200)
treea125c26a4388bc69a25df1d9d7e2cdb444231c0f
parentf865588aa6ece4c6415982509d3499df318b7389
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