Hi Steven,

> also get a build problem with -fdiagnostics-color enabled. With gcc4.9.2
> in `make test` I get: [...]

Right, the tests get confused by GCC_COLORS being set. Should be fixed by
the attached patch.

-- Joel

On 18 November 2014 19:03, Steven Honeyman <stevenhoney...@gmail.com> wrote:

> I also get a build problem with -fdiagnostics-color enabled. With
> gcc4.9.2 in `make test` I get:
>
>
> test/main
> test/test_argument_processing.c:199: Failed assertion:
>   Suite:      argument_processing
>   Test:       MQ_flag_without_immediate_argument_should_not_add_MQobj
>   Expression: act_cpp
>   Expected:   gcc -MD -MP -MFfoo.d -MQ foo.d
>   Actual:     gcc -fdiagnostics-color -MD -MP -MFfoo.d -MQ foo.d
>
> test/test_argument_processing.c:216: Failed assertion:
>   Suite:      argument_processing
>   Test:       MT_flag_without_immediate_argument_should_not_add_MTobj
>   Expression: act_cpp
>   Expected:   gcc -MD -MP -MFfoo.d -MT foo.d
>   Actual:     gcc -fdiagnostics-color -MD -MP -MFfoo.d -MT foo.d
>
> test/test_argument_processing.c:233: Failed assertion:
>   Suite:      argument_processing
>   Test:       MQ_flag_with_immediate_argument_should_not_add_MQobj
>   Expression: act_cpp
>   Expected:   gcc -MD -MP -MFfoo.d -MQfoo.d
>   Actual:     gcc -fdiagnostics-color -MD -MP -MFfoo.d -MQfoo.d
>
> test/test_argument_processing.c:250: Failed assertion:
>   Suite:      argument_processing
>   Test:       MT_flag_with_immediate_argument_should_not_add_MQobj
>   Expression: act_cpp
>   Expected:   gcc -MD -MP -MFfoo.d -MTfoo.d
>   Actual:     gcc -fdiagnostics-color -MD -MP -MFfoo.d -MTfoo.d
>
> test/test_argument_processing.c:275: Failed assertion:
>   Suite:      argument_processing
>   Test:
>  fprofile_flag_with_existing_dir_should_be_rewritten_to_real_path
>   Expression: act_cpp
>   Expected:   gcc
>
> -fprofile-generate=/tmp/makepkg/ccache-git/src/ccache/testdir.20931/argument_processing/fprofile_flag_with_existing_dir_should_be_rewritten_to_real_path/some/dir
>   Actual:     gcc
>
> -fprofile-generate=/tmp/makepkg/ccache-git/src/ccache/testdir.20931/argument_processing/fprofile_flag_with_existing_dir_should_be_rewritten_to_real_path/some/dir
> -fdiagnostics-color
>
> test/test_argument_processing.c:294: Failed assertion:
>   Suite:      argument_processing
>   Test:       fprofile_flag_with_nonexisting_dir_not_be_rewritten
>   Expression: act_cpp
>   Expected:   gcc -fprofile-generate=some/dir
>   Actual:     gcc -fprofile-generate=some/dir -fdiagnostics-color
>
> FAILED: 6 tests
> _______________________________________________
> ccache mailing list
> ccache@lists.samba.org
> https://lists.samba.org/mailman/listinfo/ccache
>
From 9c4102163228295b0263eec7f41518fd750d6f3c Mon Sep 17 00:00:00 2001
From: Joel Rosdahl <j...@rosdahl.net>
Date: Wed, 19 Nov 2014 21:48:00 +0100
Subject: [PATCH] test: Unset GCC_COLORS to avoid confusing argument processing
 tests

---
 test.sh          | 1 +
 test/framework.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/test.sh b/test.sh
index 79e3e0d..b511146 100755
--- a/test.sh
+++ b/test.sh
@@ -43,6 +43,7 @@ unset CCACHE_SLOPPINESS
 unset CCACHE_TEMPDIR
 unset CCACHE_UMASK
 unset CCACHE_UNIFY
+unset GCC_COLORS
 
 # Many tests backdate files, which updates their ctimes.  In those tests, we
 # must ignore ctimes.  Might as well do so everywhere.
diff --git a/test/framework.c b/test/framework.c
index bbb0480..3590d03 100644
--- a/test/framework.c
+++ b/test/framework.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2012 Joel Rosdahl
+ * Copyright (C) 2010-2014 Joel Rosdahl
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
@@ -18,6 +18,7 @@
 
 #include "ccache.h"
 #include "test/framework.h"
+#include "util.h"
 
 #if defined(HAVE_TERMIOS_H)
 #define USE_COLOR
@@ -64,6 +65,7 @@ cct_run(suite_fn *suites, int verbose_output)
 	suite_fn *suite;
 	int tty = is_tty(1);
 
+	x_unsetenv("GCC_COLORS"); /* Avoid confusing argument processing tests. */
 	verbose = verbose_output;
 
 	for (suite = suites; *suite; suite++) {
-- 
1.9.1

_______________________________________________
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache

Reply via email to