about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--.travis.yml2
-rwxr-xr-xtest/Concrete/ConcreteTest.py49
-rw-r--r--test/Runtime/POSIX/Write2.c6
-rw-r--r--tools/klee/Makefile2
4 files changed, 25 insertions, 34 deletions
diff --git a/.travis.yml b/.travis.yml
index 2465fba8..2675e3a8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -55,8 +55,6 @@ before_install:
     - sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.4 20
     # Install lit (llvm-lit is not available)
     - sudo pip install lit
-    # Gross! tools/klee/Makefile depends on "bc"
-    - sudo apt-get install bc
     # Setup out of source build
     - export KLEE_SRC=`pwd`
     - cd ../
diff --git a/test/Concrete/ConcreteTest.py b/test/Concrete/ConcreteTest.py
index 02eaf4d9..290991b7 100755
--- a/test/Concrete/ConcreteTest.py
+++ b/test/Concrete/ConcreteTest.py
@@ -1,55 +1,42 @@
 #!/usr/bin/python
 
+from __future__ import print_function
 import argparse
 import os
-import popen2
+import subprocess
 import sys
 import shutil
 
-def readFile(f):
-    s = ""
-    while 1:
-        data = f.read()
-        if not data:
-            break
-        s += data
-    return s
-
 def testFile(name, klee_path, lli_path):
     baseName,ext = os.path.splitext(name)
     exeFile = 'Output/linked_%s.bc'%baseName
 
-    print '-- building test bitcode --'
+    print('-- building test bitcode --')
     make_cmd = 'make %s 2>&1' % (exeFile,)
-    print "EXECUTING: %s" % (make_cmd,)
+    print("EXECUTING: %s" % (make_cmd,))
     sys.stdout.flush()
     if os.system(make_cmd):
         raise SystemExit('make failed')
 
-    print '\n-- running lli --'
-    lli_cmd = '%s -force-interpreter=true %s' % (lli_path, exeFile)
-    print "EXECUTING: %s" % (lli_cmd,)
-    lli = popen2.Popen3(lli_cmd)
-    lliOut = readFile(lli.fromchild)
-    if lli.wait():
-        raise SystemExit('lli execution failed')
+    print('\n-- running lli --')
+    lli_cmd = [lli_path, '-force-interpreter=true', exeFile]
+    print("EXECUTING: %s" % (lli_cmd,))
 
-    print '-- lli output --\n%s--\n' % (lliOut,)
+    # Decode is for python 3.x
+    lliOut = subprocess.check_output(lli_cmd).decode()
+    print('-- lli output --\n%s--\n' % (lliOut,))
 
-    print '-- running klee --'
+    print('-- running klee --')
     klee_out_path = "Output/%s.klee-out" % (baseName,)
     if os.path.exists(klee_out_path):
         shutil.rmtree(klee_out_path)
-    klee_cmd = '%s --output-dir=%s --no-output %s' % (
-        klee_path, klee_out_path, exeFile)
-    print "EXECUTING: %s" % (klee_cmd,)
+    klee_cmd = [klee_path, '--output-dir=' + klee_out_path,  '--no-output', exeFile]
+    print("EXECUTING: %s" % (klee_cmd,))
     sys.stdout.flush()
-    klee = popen2.Popen3(klee_cmd)
-    kleeOut = readFile(klee.fromchild)
-    if klee.wait():
-        raise SystemExit('klee execution failed')
 
-    print '-- klee output --\n%s--\n' % (kleeOut,)
+    # Decode is for python 3.x
+    kleeOut = subprocess.check_output(klee_cmd).decode()
+    print('-- klee output --\n%s--\n' % (kleeOut,))
         
     if lliOut != kleeOut:
         raise SystemExit('outputs differ')
@@ -59,11 +46,11 @@ def testOneFile(f, printOutput=False):
         testFile(f, printOutput)
         code = ['pass','xpass'][f.startswith('broken')]
         extra = ''
-    except TestError,e:
+    except TestError as e:
         code = ['fail','xfail'][f.startswith('broken')]
         extra = str(e)
 
-    print '%s: %s -- %s'%(code,f,extra)
+    print('%s: %s -- %s'%(code,f,extra))
 
 def main():
     parser = argparse.ArgumentParser()
diff --git a/test/Runtime/POSIX/Write2.c b/test/Runtime/POSIX/Write2.c
index edb3e5b2..97d501f6 100644
--- a/test/Runtime/POSIX/Write2.c
+++ b/test/Runtime/POSIX/Write2.c
@@ -1,6 +1,12 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 --sym-stdout 2>%t.log
+//
+// Disable this test on LLVM 3.4 for now, it seems to hang indefinitely when run
+// in our Travis CI config.
+//
+// FIXME: Investigate.
+// REQUIRES: not-llvm-3.4
 
 #include <stdio.h>
 #include <assert.h>
diff --git a/tools/klee/Makefile b/tools/klee/Makefile
index e526f2a2..03b387c0 100644
--- a/tools/klee/Makefile
+++ b/tools/klee/Makefile
@@ -15,7 +15,7 @@ include $(LEVEL)/Makefile.config
 USEDLIBS = kleeCore.a kleeBasic.a kleeModule.a  kleaverSolver.a kleaverExpr.a kleeSupport.a 
 LINK_COMPONENTS = jit bitreader bitwriter ipo linker engine
 
-ifeq ($(shell echo "$(LLVM_VERSION_MAJOR).$(LLVM_VERSION_MINOR) >= 3.3" | bc), 1)
+ifeq ($(shell python -c "print($(LLVM_VERSION_MAJOR).$(LLVM_VERSION_MINOR) >= 3.3)"), True)
 LINK_COMPONENTS += irreader
 endif
 include $(LEVEL)/Makefile.common