This is an archive of the discontinued LLVM Phabricator instance.

Fix getCompiler in unit testing framework on compiler symlinks
AbandonedPublic

Authored by fjricci on Jan 22 2016, 2:24 PM.

Details

Summary

Checks using the result of getCompiler() will fail to identify the compiler
correctly if CC is a symlink path (ie /usr/bin/cc).

Use "CC" -v to determine the actual compiler type in these cases.

Diff Detail

Event Timeline

fjricci updated this revision to Diff 45743.Jan 22 2016, 2:24 PM
fjricci updated this revision to Diff 45745.
fjricci retitled this revision from to Fix getCompiler in unit testing framework on compiler symlinks.
fjricci updated this object.
fjricci added reviewers: zturner, emaste.
fjricci added subscribers: sas, llvm-commits.

Accidentally ran clang-format, fix an indentation error

zturner added inline comments.Jan 22 2016, 3:05 PM
packages/Python/lldbsuite/test/plugins/builder_base.py
30–39

This works, but I think it could be better. It sounds like what you really want to do is resolve the symlink. What about this:

def getCompiler():
    compiler = os.environ.get("CC", "clang")
    return os.path.realpath(compiler)
fjricci marked an inline comment as done.Jan 22 2016, 3:16 PM
fjricci added inline comments.
packages/Python/lldbsuite/test/plugins/builder_base.py
30–39

That works, and is much cleaner, thanks!

fjricci updated this revision to Diff 45759.Jan 22 2016, 3:18 PM
fjricci marked an inline comment as done.

Resolve symlink instead of parsing version output

fjricci updated this revision to Diff 45760.Jan 22 2016, 3:18 PM

Clean up imports

sas added a comment.Feb 1 2016, 3:26 PM

Committed as r259433.

This caused a regression when the compiler was specified without a full path (I've fixed it in r259484, this is just an FYI).

Also, please put @lldb-commits (not LLVM) as a subscriber on the diff next time.

cheers,
pl

fjricci abandoned this revision.Mar 25 2016, 4:47 PM

Committed.