| |
@@ -0,0 +1,108 @@
|
| |
+ From b7730d0af55b5270c7941783812ca9b3fe0002c3 Mon Sep 17 00:00:00 2001
|
| |
+ From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= <l.lunak@centrum.cz>
|
| |
+ Date: Mon, 29 Jan 2018 17:55:15 +0100
|
| |
+ Subject: [PATCH] make sure that icerun only invokes locally the given command
|
| |
+
|
| |
+ ---
|
| |
+ client/arg.cpp | 15 ++++++++++-----
|
| |
+ tests/test.sh | 26 ++++++++++++++++++++++++++
|
| |
+ 2 files changed, 36 insertions(+), 5 deletions(-)
|
| |
+
|
| |
+ diff --git a/client/arg.cpp b/client/arg.cpp
|
| |
+ index b3ae8da..44d5516 100644
|
| |
+ --- a/client/arg.cpp
|
| |
+ +++ b/client/arg.cpp
|
| |
+ @@ -246,6 +246,10 @@ bool analyse_argv(const char * const *argv, CompileJob &job, bool icerun, list<s
|
| |
+ always_local = true;
|
| |
+ job.setLanguage(CompileJob::Lang_Custom);
|
| |
+ log_info() << "icerun, running locally." << endl;
|
| |
+ + } else if(always_local) {
|
| |
+ + // By this point this is set only if analyze_program() decided the command is not a compiler,
|
| |
+ + // so this means also running a custom command as if invoked by icerun.
|
| |
+ + icerun = true;
|
| |
+ }
|
| |
+
|
| |
+ for (int i = had_cc ? 2 : 1; argv[i]; i++) {
|
| |
+ @@ -683,6 +687,7 @@ bool analyse_argv(const char * const *argv, CompileJob &job, bool icerun, list<s
|
| |
+
|
| |
+ args.append("-S", Arg_Remote);
|
| |
+ } else {
|
| |
+ + assert( seen_c );
|
| |
+ args.append("-c", Arg_Remote);
|
| |
+ if (seen_split_dwarf) {
|
| |
+ job.setDwarfFissionEnabled(true);
|
| |
+ @@ -791,22 +796,22 @@ bool analyse_argv(const char * const *argv, CompileJob &job, bool icerun, list<s
|
| |
+ }
|
| |
+ }
|
| |
+
|
| |
+ - } else {
|
| |
+ + } else { // always_local
|
| |
+ job.setInputFile(string());
|
| |
+ }
|
| |
+
|
| |
+ struct stat st;
|
| |
+
|
| |
+ - if (ofile.empty() || (!stat(ofile.c_str(), &st) && !S_ISREG(st.st_mode))) {
|
| |
+ - if (!always_local) {
|
| |
+ + if( !always_local ) {
|
| |
+ + if (ofile.empty() || (!stat(ofile.c_str(), &st) && !S_ISREG(st.st_mode))) {
|
| |
+ log_info() << "output file empty or not a regular file, building locally" << endl;
|
| |
+ + always_local = true;
|
| |
+ }
|
| |
+ - always_local = true;
|
| |
+ }
|
| |
+
|
| |
+ // redirecting compiler's output will turn off its automatic coloring, so force it
|
| |
+ // when it would be used, unless explicitly set
|
| |
+ - if (compiler_has_color_output(job) && !explicit_color_diagnostics) {
|
| |
+ + if (!icerun && compiler_has_color_output(job) && !explicit_color_diagnostics) {
|
| |
+ if (compiler_is_clang(job))
|
| |
+ args.append("-fcolor-diagnostics", Arg_Rest);
|
| |
+ else
|
| |
+ diff --git a/tests/test.sh b/tests/test.sh
|
| |
+ index 48e1162..e9747e4 100755
|
| |
+ --- a/tests/test.sh
|
| |
+ +++ b/tests/test.sh
|
| |
+ @@ -877,6 +877,31 @@ icerun_nopath_test()
|
| |
+ export PATH=$save_path
|
| |
+ }
|
| |
+
|
| |
+ +icerun_nocompile_test()
|
| |
+ +{
|
| |
+ + # check that 'icerun gcc' still only runs the command without trying a remote compile
|
| |
+ + reset_logs "" "icerun${noscheduler} nocompile test"
|
| |
+ + echo "Running icerun nocompile test."
|
| |
+ + rm -rf -- "$testdir"/fakegcc
|
| |
+ + mkdir -p "$testdir"/fakegcc
|
| |
+ + echo '#! /bin/sh' > "$testdir"/fakegcc/gcc
|
| |
+ + echo 'echo "$@" >' "$testdir"/fakegcc/output >> "$testdir"/fakegcc/gcc
|
| |
+ + echo 'exit 44' >> "$testdir"/fakegcc/gcc
|
| |
+ + chmod +x "$testdir"/fakegcc/gcc
|
| |
+ + args="-Wall a.c b.c -c -s"
|
| |
+ + ICECC_TEST_SOCKET="$testdir"/socket-localice ICECC_TEST_REMOTEBUILD=1 ICECC_DEBUG=debug ICECC_LOGFILE="$testdir"/icecc.log \
|
| |
+ + PATH="$testdir"/fakegcc:$PATH $valgrind "${icerun}" gcc $args
|
| |
+ + if test $? -ne 44; then
|
| |
+ + echo Error, icerun gcc failed.
|
| |
+ + stop_ice 0
|
| |
+ + abort_tests
|
| |
+ + fi
|
| |
+ + check_log_message icecc "invoking: $testdir/fakegcc/gcc $args\$"
|
| |
+ + rm -rf -- "$testdir"/fakegcc
|
| |
+ + echo "Icerun nocompile test successful."
|
| |
+ + echo
|
| |
+ +}
|
| |
+ +
|
| |
+ # Check that icecc --build-native works.
|
| |
+ buildnativetest()
|
| |
+ {
|
| |
+ @@ -1740,6 +1765,7 @@ fi
|
| |
+ fi
|
| |
+
|
| |
+ icerun_test
|
| |
+ +icerun_nocompile_test
|
| |
+
|
| |
+ recursive_test
|
| |
+
|
| |
+ --
|
| |
+ 2.14.3
|
| |
+
|
| |
"icerun" erroneously always adds -fdiagnostics-color which typically causes the command to fail due to invalid argument; this upstream patch appears to fix it.