-
Notifications
You must be signed in to change notification settings - Fork 27
/
valgrind_tester
executable file
·40 lines (39 loc) · 1.41 KB
/
valgrind_tester
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env ruby
require 'fileutils'
print("Regression tester 0.0.1\n")
def path_local(from)
return from #from.gsub('/','//')
from.gsub('/','\\\\')
end
TESTS_DIR="./tests"
def perform_test(exepath,filepath,outname,args)
output_path=path_local(TESTS_DIR+"/outputs/"+outname)
error_path=path_local(TESTS_DIR+"/errors/"+outname)
exepath=path_local(exepath)
output_path=path_local(output_path)
filepath=path_local(filepath)
joined_args = args.join(' ')
printf("calling:" + "#{exepath} #{joined_args} -o#{output_path}.a1 #{filepath}\n")
valgrind_mode="valgrind --track-origins=yes "
#valgrind --tool=callgrind --dump-instr=yes --collect-jumps=yes
result = `#{valgrind_mode} #{exepath} #{joined_args} -a1 -o#{output_path}.b #{filepath} 2>#{error_path}.val`
result = `#{valgrind_mode} #{exepath} #{joined_args} -a2 -o#{output_path}.b #{filepath} 2>>#{error_path}.val`
result = `#{valgrind_mode} #{exepath} #{joined_args} -o#{output_path}.b #{filepath} 2>>#{error_path}.val`
puts result
p $?
end
`rm -rf #{TESTS_DIR}/outputs/*.*`
#exit(1)
if(ARGV.size()==0)
puts("valgrind_tester DCC_EXECUTABLE")
exit(0)
end
Dir.open(TESTS_DIR+"/inputs").each() {|f|
next if f=="." or f==".."
perform_test(".//"+ARGV[0],TESTS_DIR+"/inputs/"+f,f,ARGV[1..-1])
}
Dir.open(TESTS_DIR+"/inputs").each() {|f|
next if f=="." or f==".."
FileUtils.mv(TESTS_DIR+"/inputs/"+f,TESTS_DIR+"/outputs/"+f) if f.end_with?(".b")
}
"diff -rqbwB"