tests.cc-wrapper: show command output on different line

this is much easier to read.
This commit is contained in:
Artturin 2023-09-07 04:51:52 +03:00
parent 1b6c3aed63
commit 535447e289

View File

@ -22,16 +22,16 @@ in stdenv.mkDerivation {
NIX_DEBUG=1 $CC -v
NIX_DEBUG=1 $CXX -v
printf "checking whether compiler builds valid C binaries... " >&2
echo "checking whether compiler builds valid C binaries... " >&2
$CC -o cc-check ${./cc-main.c}
${emulator} ./cc-check
printf "checking whether compiler builds valid C++ binaries... " >&2
echo "checking whether compiler builds valid C++ binaries... " >&2
$CXX -o cxx-check ${./cxx-main.cc}
${emulator} ./cxx-check
${lib.optionalString (stdenv.isDarwin && stdenv.cc.isClang) ''
printf "checking whether compiler can build with CoreFoundation.framework... " >&2
echo "checking whether compiler can build with CoreFoundation.framework... " >&2
mkdir -p foo/lib
$CC -framework CoreFoundation -o core-foundation-check ${./core-foundation-main.c}
${emulator} ./core-foundation-check
@ -39,11 +39,11 @@ in stdenv.mkDerivation {
${lib.optionalString (!stdenv.isDarwin) ''
printf "checking whether compiler builds valid static C binaries... " >&2
echo "checking whether compiler builds valid static C binaries... " >&2
$CC ${staticLibc} -static -o cc-static ${./cc-main.c}
${emulator} ./cc-static
${lib.optionalString (stdenv.cc.isGNU && lib.versionAtLeast (lib.getVersion stdenv.cc.name) "8.0.0") ''
printf "checking whether compiler builds valid static pie C binaries... " >&2
echo "checking whether compiler builds valid static pie C binaries... " >&2
$CC ${staticLibc} -static-pie -o cc-static-pie ${./cc-main.c}
${emulator} ./cc-static-pie
''}
@ -52,7 +52,7 @@ in stdenv.mkDerivation {
${# See: https://github.com/llvm/llvm-project/commit/ed1d07282cc9d8e4c25d585e03e5c8a1b6f63a74
# `gcc` does not support this so we gate the test on `clang`
lib.optionalString stdenv.cc.isClang ''
printf "checking whether cc-wrapper accepts -- followed by positional (file) args..." >&2
echo "checking whether cc-wrapper accepts -- followed by positional (file) args..." >&2
mkdir -p positional
# Make sure `--` is not parsed as a "non flag arg"; we should get an
@ -70,13 +70,13 @@ in stdenv.mkDerivation {
${emulator} ./positional/main
''}
printf "checking whether compiler uses NIX_CFLAGS_COMPILE... " >&2
echo "checking whether compiler uses NIX_CFLAGS_COMPILE... " >&2
mkdir -p foo/include
cp ${./foo.c} foo/include/foo.h
NIX_CFLAGS_COMPILE="-Ifoo/include -DVALUE=42" $CC -o cflags-check ${./cflags-main.c}
${emulator} ./cflags-check
printf "checking whether compiler uses NIX_LDFLAGS... " >&2
echo "checking whether compiler uses NIX_LDFLAGS... " >&2
mkdir -p foo/lib
$CC -shared \
${lib.optionalString stdenv.isDarwin "-Wl,-install_name,@rpath/libfoo.dylib"} \
@ -87,7 +87,7 @@ in stdenv.mkDerivation {
NIX_LDFLAGS="-L$NIX_BUILD_TOP/foo/lib -rpath $NIX_BUILD_TOP/foo/lib" $CC -lfoo -o ldflags-check ${./ldflags-main.c}
${emulator} ./ldflags-check
printf "Check whether -nostdinc and -nostdinc++ is handled correctly" >&2
echo "Check whether -nostdinc and -nostdinc++ is handled correctly" >&2
mkdir -p std-include
cp ${./stdio.h} std-include/stdio.h
NIX_DEBUG=1 $CC -I std-include -nostdinc -o nostdinc-main ${./nostdinc-main.c}
@ -96,7 +96,7 @@ in stdenv.mkDerivation {
${emulator} ./nostdinc-main++
${lib.optionalString sanitizersWorking ''
printf "checking whether sanitizers are fully functional... ">&2
echo "checking whether sanitizers are fully functional... ">&2
$CC -o sanitizers -fsanitize=address,undefined ${./sanitizers.c}
ASAN_OPTIONS=use_sigaltstack=0 ${emulator} ./sanitizers
''}