Skip to content

Commit

Permalink
Checking output of "gcc --version" and execute in right test scenario.
Browse files Browse the repository at this point in the history
  • Loading branch information
pvicente committed Feb 20, 2018
1 parent f0ddff0 commit 22b941a
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion conans/test/util/detect_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import platform
import unittest
from subprocess import Popen, PIPE, STDOUT

from conans import tools
from conans.client.conf.detect import detect_defaults_settings
Expand All @@ -22,9 +23,30 @@ def detect_default_compilers_test(self):
if platform_compiler is not None:
self.assertEquals(result.get("compiler", None), platform_compiler)

@unittest.skipIf(platform.system() != "Darwin", "Test only running in Mac OS X")
def detect_default_in_mac_os_using_gcc_as_default_test(self):
"""
In some Mac OS X gcc is in reality clang.
"""
# See: https://github.com/conan-io/conan/issues/2231
def _execute(command):
proc = Popen(command, shell=True, bufsize=1, stdout=PIPE, stderr=STDOUT)

output_buffer = []
while True:
line = proc.stdout.readline()
if not line:
break
# output.write(line)
output_buffer.append(str(line))

proc.communicate()
return proc.returncode, "".join(output_buffer)

proc_return, output = _execute("gcc --version")
if proc_return != 0 or "clang" not in output:
# Not test scenario (gcc should display that it's clang)
return

output = TestBufferConanOutput()
with tools.environment_append({"CC": "gcc"}):
result = detect_defaults_settings(output)
Expand Down

0 comments on commit 22b941a

Please sign in to comment.