From: Joel Rosdahl Date: Sun, 28 Jan 2018 15:06:36 +0000 (+0100) Subject: test: Verify that UNCACHED_ERR_FD works X-Git-Tag: v3.3.6~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=313e6f4c7b28ddff49bfaa406d8aa5ab55737bc6;p=thirdparty%2Fccache.git test: Verify that UNCACHED_ERR_FD works --- diff --git a/test.sh b/test.sh index b2d6bf9f0..d750afebd 100755 --- a/test.sh +++ b/test.sh @@ -1076,6 +1076,38 @@ EOF expect_stat 'cache hit (preprocessed)' 0 expect_stat 'cache miss' 0 expect_stat 'unsupported code directive' 1 + + # ------------------------------------------------------------------------- + TEST "UNCACHED_ERR_FD" + + cat >compiler.sh <<'EOF' +#!/bin/sh +if [ "$1" = "-E" ]; then + echo preprocessed + printf ${N}Pu >&$UNCACHED_ERR_FD +else + echo compiled >test1.o + printf ${N}Cc >&2 + printf ${N}Cu >&$UNCACHED_ERR_FD +fi +EOF + chmod +x compiler.sh + + N=1 $CCACHE ./compiler.sh -c test1.c 2>stderr.txt + stderr=$(cat stderr.txt) + expect_stat 'cache hit (preprocessed)' 0 + expect_stat 'cache miss' 1 + if [ "$stderr" != "1Pu1Cu1Cc" ]; then + test_failed "Unexpected stderr: $stderr != 1Pu1Cu1Cc" + fi + + N=2 $CCACHE ./compiler.sh -c test1.c 2>stderr.txt + stderr=$(cat stderr.txt) + expect_stat 'cache hit (preprocessed)' 1 + expect_stat 'cache miss' 1 + if [ "$stderr" != "2Pu1Cc" ]; then + test_failed "Unexpected stderr: $stderr != 2Pu1Cc" + fi } # =============================================================================