about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2017-03-30 11:42:30 +0100
committerDan Liew <delcypher@gmail.com>2017-04-06 11:11:39 +0100
commit2d6bf37812556609872dc63adcf2291fe58aba17 (patch)
tree1c2dbaad1a0ef411a7f778659d184f51602223bb
parentdd81784b0de223af32f712b1c2c28d667049be33 (diff)
downloadklee-2d6bf37812556609872dc63adcf2291fe58aba17.tar.gz
[NFC] Reindent `test/lit.cfg` and add vim mode line to use right
indentation and syntax highlighting.
-rw-r--r--test/lit.cfg98
1 files changed, 63 insertions, 35 deletions
diff --git a/test/lit.cfg b/test/lit.cfg
index 1a988863..8f399642 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -1,4 +1,6 @@
 # -*- Python -*-
+# vim: set filetype=python:
+# vim: ts=2:sts=2:sw=2:et:tw=80:
 
 # Configuration file for the 'lit' test runner.
 
@@ -8,10 +10,10 @@ import re
 import platform
 
 try:
-   import lit.util
-   import lit.formats
+  import lit.util
+  import lit.formats
 except ImportError:
-   pass
+  pass
 
 # name: The name of this test suite.
 config.name = 'KLEE'
@@ -31,27 +33,33 @@ klee_obj_root = getattr(config, 'klee_obj_root', None)
 klee_src_root = getattr(config, 'klee_src_root', None)
 
 if klee_obj_root is not None:
-    config.test_exec_root = os.path.join(klee_obj_root, 'test')
+  config.test_exec_root = os.path.join(klee_obj_root, 'test')
 
 # Tweak the PATH to include the tool dir.
 if klee_obj_root is not None:
-    klee_tools_dir = getattr(config, 'klee_tools_dir', None)
-    if not klee_tools_dir:
-        lit.fatal('No KLEE tools dir set!')
+  klee_tools_dir = getattr(config, 'klee_tools_dir', None)
+  if not klee_tools_dir:
+    lit.fatal('No KLEE tools dir set!')
 
-    # Check LLVM tool directory
-    llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
-    if not llvm_tools_dir:
-        lit.fatal('No LLVM tool directory set!')
+  # Check LLVM tool directory
+  llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
+  if not llvm_tools_dir:
+    lit.fatal('No LLVM tool directory set!')
 
-    path = os.path.pathsep.join((llvm_tools_dir, klee_tools_dir, config.environment['PATH'] ))
-    config.environment['PATH'] = path
+  path = os.path.pathsep.join(
+    (
+      llvm_tools_dir,
+      klee_tools_dir,
+      config.environment['PATH']
+    )
+  )
+  config.environment['PATH'] = path
 
 
 # Propogate some environment variable to test environment.
 def addEnv(name):
-    if name in os.environ:
-        config.environment[name] = os.environ[name]
+  if name in os.environ:
+    config.environment[name] = os.environ[name]
 
 addEnv('HOME')
 addEnv('PWD')
@@ -72,27 +80,37 @@ addEnv('CPLUS_INCLUDE_PATH')
 
 # Check that the object root is known.
 if config.test_exec_root is None:
-    lit.fatal('test execution root not set!')
+  lit.fatal('test execution root not set!')
 
 
 # Add substitutions from lit.site.cfg
 subs = [ 'llvmgcc', 'llvmgxx', 'cc', 'cxx']
 for name in subs:
-    value = getattr(config, name, None)
-    if value == None:
-        lit.fatal('{0} is not set'.format(name))
-    config.substitutions.append( ('%' + name, value))
+  value = getattr(config, name, None)
+  if value == None:
+    lit.fatal('{0} is not set'.format(name))
+  config.substitutions.append( ('%' + name, value))
 
 # Add a substitution for lli.
-config.substitutions.append( ('%lli', os.path.join(llvm_tools_dir, 'lli')) )
+config.substitutions.append(
+  ('%lli', os.path.join(llvm_tools_dir, 'lli'))
+)
 # Add a substitution for llvm-as
-config.substitutions.append( ('%llvmas', os.path.join(llvm_tools_dir, 'llvm-as')) )
+config.substitutions.append(
+  ('%llvmas', os.path.join(llvm_tools_dir, 'llvm-as'))
+)
 # Add a substitution for llvm-ar
-config.substitutions.append( ('%llvmar', os.path.join(llvm_tools_dir, 'llvm-ar')) )
+config.substitutions.append(
+  ('%llvmar', os.path.join(llvm_tools_dir, 'llvm-ar'))
+)
 
 # Add a substition for libkleeruntest
-config.substitutions.append( ('%libkleeruntestdir', os.path.dirname(config.libkleeruntest)) )
-config.substitutions.append( ('%libkleeruntest', config.libkleeruntest) )
+config.substitutions.append(
+  ('%libkleeruntestdir', os.path.dirname(config.libkleeruntest))
+)
+config.substitutions.append(
+  ('%libkleeruntest', config.libkleeruntest)
+)
 
 # Get KLEE and Kleaver specific parameters passed on llvm-lit cmd line
 # e.g. llvm-lit --param klee_opts=--help
@@ -106,9 +124,13 @@ else:
   kleaver_extra_params = lit.params.get('kleaver_opts',"")
 
 if len(klee_extra_params) != 0:
-    print("Passing extra KLEE command line args: {0}".format(klee_extra_params))
+  print("Passing extra KLEE command line args: {0}".format(
+    klee_extra_params)
+  )
 if len(kleaver_extra_params) != 0:
-    print("Passing extra Kleaver command line args: {0}".format(kleaver_extra_params))
+  print("Passing extra Kleaver command line args: {0}".format(
+    kleaver_extra_params)
+  )
 
 # Set absolute paths and extra cmdline args for KLEE's tools
 subs = [ ('%kleaver', 'kleaver', kleaver_extra_params),
@@ -116,17 +138,23 @@ subs = [ ('%kleaver', 'kleaver', kleaver_extra_params),
   ('%ktest-tool', 'ktest-tool', '')
 ]
 for s,basename,extra_args in subs:
-    config.substitutions.append( ( s,
-                                   "{0} {1}".format( os.path.join(klee_tools_dir, basename), extra_args ).strip()
-                                 )
-                               )
-
-config.substitutions.append( ('%gentmp', os.path.join(klee_src_root, 'scripts/genTempFiles.sh')) )
+  config.substitutions.append(
+    ( s,
+      "{0} {1}".format(
+        os.path.join(klee_tools_dir, basename),
+        extra_args
+      ).strip()
+    )
+  )
+
+config.substitutions.append(
+  ('%gentmp', os.path.join(klee_src_root, 'scripts/genTempFiles.sh'))
+)
 
 # LLVM < 3.0 doesn't Support %T directive
 if int(config.llvm_version_major) == 2:
-    # This is a hack
-    config.substitutions.append(('%T','Output'))
+  # This is a hack
+  config.substitutions.append(('%T','Output'))
 
 # Add feature for the LLVM version in use, so it can be tested in REQUIRES and
 # XFAIL checks. We also add "not-XXX" variants, for the same reason.