[LLVMdev] LNT: failing to parse compiler info: what am I doing wrong?

Sean Silva silvas at purdue.edu
Wed Sep 5 19:23:17 PDT 2012

Hi, I'm trying to use LNT to run the test-suite. I followed the
instructions on <http://lnt.llvm.org/quickstart.html>. When I run it I
get this error:

(mysandbox)sean:~/pg/others/llvm % lnt runtest nt --sandbox mysandbox
--cc ~/pg/others/llvm/release/bin/clang --test-suite test-suite
nt.py:1185: note: inferred C++ compiler under test as:
2012-09-06 02:03:16: checking source versions
compilers.py:81: error: unable to determine compiler version:
'/home/sean/pg/others/llvm/release/bin/clang': 'clang version 3.2 '
Traceback (most recent call last):
  File "/home/sean/pg/others/llvm/mysandbox/bin/lnt", line 9, in <module>
    load_entry_point('LNT==0.4.1dev', 'console_scripts', 'lnt')()
  File "/home/sean/pg/others/llvm/lnt/lnt/lnttool/main.py", line 281, in main
    commands[cmd](cmd, args[1:])
  File "/home/sean/pg/others/llvm/lnt/lnt/lnttool/main.py", line 149,
in action_runtest
    report = test_instance.run_test('%s %s' % (name, test_name), args)
  File "/home/sean/pg/others/llvm/lnt/lnt/tests/nt.py", line 1288, in run_test
    report = run_test(nick, opts, None, report_dir)
  File "/home/sean/pg/others/llvm/lnt/lnt/tests/nt.py", line 645, in run_test
  File "/home/sean/pg/others/llvm/lnt/lnt/testing/util/compilers.py",
line 82, in get_cc_info
    cc_name,cc_version_num,cc_build_string,cc_extra = m.groups()
AttributeError: 'NoneType' object has no attribute 'groups'

I took a look at the code and basically it's doing some nasty ad-hoc
regex parsing to try to figure out the compiler version and when the
regex doesn't match, the re library returns None, which it later dies
on. I'm no stranger to Python and would be happy to hack around this,
but I find it strange that a vanilla Clang is causing this to barf,
since presumably clang is the most heavily used; and there's even code
in there for pulling out versions from GCC and ICC!

Am I doing something wrong? It certainly feels like I'm doing
something wrong. If not I'll hack around it and send in a patch.

I'd be glad to provide clang output (e.g. -v) if it would help to
understand the problem; just let me know what you want, since I'm not
sure exactly what would be most helpful.

Another thing: aren't those calls to `error()` in compilers.py
supposed to abort the processing immediately? I mean, it does a None
check, calls `error()` and prints an error message, and then barfs
executing code that assumes that the match object is not None. The
C/C++ equivalent would be:

if (p == NULL)
  error("p is NULL"); // Just prints, doesn't longjmp or throw an
exception or anything.

--Sean Silva

More information about the llvm-dev mailing list