Skip to content

Commit

Permalink
unit-tests: Fix build of fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsergio committed Sep 4, 2015
1 parent a7567ff commit 50765ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Makefile
*.o
ast_dump.output
install_manifest.txt
*_fixed
*_fixed.cpp
empty.o*
compile_fixed.output
*.o-*
15 changes: 11 additions & 4 deletions tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#-------------------------------------------------------------------------------
# Global variables

_compiler_comand = "clang++ -std=c++11 -Wno-unused-value -Qunused-arguments -Xclang -load -Xclang ClangLazy.so -Xclang -add-plugin -Xclang clang-lazy -Xclang -plugin-arg-clang-lazy -Xclang no-inplace-fixits -c " + QT_FLAGS + " -Xclang -plugin-arg-clang-lazy"
_compiler_comand = "clang++ -std=c++11 -Wno-unused-value -Qunused-arguments -Xclang -load -Xclang ClangLazy.so -Xclang -add-plugin -Xclang clang-lazy -Xclang -plugin-arg-clang-lazy -Xclang no-inplace-fixits -c " + QT_FLAGS
_dump_ast_command = "clang++ -std=c++11 -fsyntax-only -Xclang -ast-dump -fno-color-diagnostics -c *.cpp " + QT_FLAGS
_help_command = "clang++ -Xclang -load -Xclang ClangLazy.so -Xclang -add-plugin -Xclang clang-lazy -Xclang -plugin-arg-clang-lazy -Xclang help -c empty.cpp"
_dump_ast = "--dump-ast" in sys.argv
Expand Down Expand Up @@ -53,7 +53,7 @@ def get_check_list():

# Returns all files with .cpp_fixed extension. These were rewritten by clang.
def get_fixed_files():
return filter(lambda entry: entry.endswith('.cpp_fixed'), os.listdir("."))
return filter(lambda entry: entry.endswith('.cpp_fixed.cpp'), os.listdir("."))

def print_differences(file1, file2):
return run_command("diff -Naur test.expected test.output")
Expand All @@ -67,12 +67,19 @@ def extract_word(word, in_file, out_file):
in_f.close()
out_f.close()

def cleanup_fixed_files():
fixed_files = get_fixed_files()
for fixed_file in fixed_files:
os.remove(fixed_file)

def run_check_unit_tests(check):
cmd = _compiler_comand + " -Xclang " + check + " *.cpp "
cmd = _compiler_comand + " -Xclang -plugin-arg-clang-lazy -Xclang " + check + " *.cpp "

if _verbose:
print "Running: " + cmd

cleanup_fixed_files()

if not run_command(cmd + " &> compile.output"):
print "[FAIL] " + check + " (Failed to build test. Check " + check + "/compile.output for details)"
print
Expand All @@ -93,7 +100,7 @@ def run_check_unit_tests(check):
if run_command(_compiler_comand + " " + fixed_file + " &> compile_fixed.output"):
print " [OK] " + fixed_file
else:
print " [FAIL] " + check + " (Failed to build test. Check " + check + "/compile.output for details)"
print " [FAIL] " + check + " (Failed to build test. Check " + check + "/compile_fixed.output for details)"
print
return False

Expand Down

0 comments on commit 50765ea

Please sign in to comment.