I'm trying to run a simple test with llvm-lit. I have a dedicated directory:
llvm-lit-dir
+---lit.cfg
+---llvm_lit_example.c
The cfg file is from llvm-3.8.0/utils/lit/lit/ExampleTests.ObjDir. Here it is:
$ cat lit.cfg
config.example_obj_root = os.path.dirname(__file__)
lit.load_config(config, os.path.join(config.test_source_root,'lit.cfg'))
Here is the example I'm trying to check:
$ cat llvm_lit_example.c
// RUN: %clang -o %t0 %s
// RUN: %t0 | grep "YES"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int i=rand()%4;
char s1[5]={'0','1','2','3', 0 };
char s2[5]={'0','1','2','3', 0 };
s1[i]='6';
if (strcmp(s1,s2) == 0) printf("NO \n");
if (strcmp(s1,s2) != 0) printf("YES\n");
}
I've tried several options but none seem to work:
$ llvm-lit llvm-lit-dir/llvm_lit_example.c
llvm-lit: TestingConfig.py:114: fatal: unable to parse config file '/home//llvm-lit-dir/lit.site.cfg', traceback: Traceback (most recent call last):
File "/home/llvm-3.8.0/llvm/utils/lit/lit/TestingConfig.py", line 101, in load_from_path
exec(compile(data, path, 'exec'), cfg_globals, None)
File "/home/llvm-lit-dir/lit.site.cfg", line 14, in <module>
lit.load_config(config, os.path.join(config.test_source_root,'lit.cfg'))
NameError: name 'lit' is not defined
What am I doing wrong? Thanks!
Aucun commentaire:
Enregistrer un commentaire