title: Hello world llvm-lit with cfg file
body: <p>I'm trying to run a simple test with llvm-lit. I have a dedicated directory:</p>
  
  <pre><code>llvm-lit-dir
  +---lit.cfg
  +---llvm_lit_example.c
  </code></pre>
  
  <p>The cfg file is from llvm-3.8.0/utils/lit/lit/ExampleTests.ObjDir.
  Here it is:</p>
  
  <pre><code>$ cat lit.cfg
  config.example_obj_root = os.path.dirname(__file__)
  lit.load_config(config, os.path.join(config.test_source_root,'lit.cfg'))
  </code></pre>
  
  <p>Here is the example I'm trying to check:</p>
  
  <pre><code>$ cat llvm_lit_example.c
  // RUN: %clang -o %t0 %s
  // RUN: %t0 | grep "YES"
  
  #include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  
  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");
  }
  </code></pre>
  
  <p>I've tried several options but none seem to work:</p>
  
  <pre><code>$ 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 &lt;module&gt;
    lit.load_config(config, os.path.join(config.test_source_root,'lit.cfg'))
  NameError: name 'lit' is not defined
  </code></pre>
  
  <p>What am I doing wrong? Thanks!</p>