• Dmitry Safonov's avatar
    zdtm: rely on -D_GNU_SOURCE passed from Makefiles · 3bdaf5a9
    Dmitry Safonov authored
    After the commit
      02c763939c10 ("test/zdtm: unify common code")
    
    CFLAGS with -D_GNU_SOURCE defined in the top Makefile
    are being passed to tests Makefiles.
    As _GNU_SOURCE is also defined by tests, that resulted in
    zdtm tests build failures:
    
      make[2]: Entering directory `/home/criu/test/zdtm/lib'
       CC        test.o
      test.c:1:0: error: "_GNU_SOURCE" redefined [-Werror]
       #define _GNU_SOURCE
       ^
      <command-line>:0:0: note: this is the location of the previous definition
      cc1: all warnings being treated as errors
      make[2]: *** [test.o] Error 1
    
    However, we didn't catch this in time by Travis-CI, as zdtm.py doesn't
    do `make zdtm`, rather it does `make -C test/zdtm/{lib,static,transition}`.
    By calling middle makefile this way, it doesn't have _GNU_SOURCE in
    CFLAGS from top-Makefile.
    
    I think the right thing to do here - is following CRIU's way:
    rely on definition of _GNU_SOURCE by Makefiles.
    
    This patch is almost fully generated with
      find test/zdtm/ -name '*.c' -type f					\
         -exec sed -i '/define _GNU_SOURCE/{n;/^$/d;}' '{}' \;		\
         -exec sed -i '/define _GNU_SOURCE/d' '{}' \;
    
    With an exception for adding -D_GNU_SOURCE in tests Makefile.inc for
    keeping the same behaviour for zdtm.py.
    Also changed utsname.c to use utsname::domainname, rather private
    utsname::__domainname, as now it's uncovered (from sys/utsname.h):
    > struct utsname
    >  {
    ...
    > # ifdef __USE_GNU
    >     char domainname[_UTSNAME_DOMAIN_LENGTH];
    > # else
    >     char __domainname[_UTSNAME_DOMAIN_LENGTH];
    > # endif
    Reported-by: 's avatarAdrian Reber <areber@redhat.com>
    Cc: Kir Kolyshkin <kir@openvz.org>
    Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
    Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
    3bdaf5a9
Name
Last commit
Last update
Documentation Loading commit data...
compel Loading commit data...
contrib Loading commit data...
coredump Loading commit data...
crit Loading commit data...
criu Loading commit data...
images Loading commit data...
include/common Loading commit data...
lib Loading commit data...
scripts Loading commit data...
soccr Loading commit data...
test Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
INSTALL.md Loading commit data...
Makefile Loading commit data...
Makefile.compel Loading commit data...
Makefile.config Loading commit data...
Makefile.install Loading commit data...
Makefile.versions Loading commit data...
README.md Loading commit data...