|
|
|
@ -96,6 +96,8 @@ def run_py_test(testname):
|
|
|
|
|
'''Runs a python test, which executes code directly rather than queries'''
|
|
|
|
|
print "Running python test: \033[35;1m%s\033[0m" % testname
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
|
|
expr=readfile('%s%s.python' % (tests_path,testname))
|
|
|
|
|
result=eval(expr,rels) #Evaluating the expression
|
|
|
|
|
|
|
|
|
@ -105,7 +107,8 @@ def run_py_test(testname):
|
|
|
|
|
if result==exp_result:
|
|
|
|
|
print "\033[32;1mTest passed\033[0m"
|
|
|
|
|
return True
|
|
|
|
|
else:
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
|
print "\033[31;1mERROR\033[0m"
|
|
|
|
|
print "\033[31;1m=====================================\033[0m"
|
|
|
|
|
print "Expected %s" % exp_result
|
|
|
|
@ -121,6 +124,14 @@ def run_test(testname):
|
|
|
|
|
The query will be executed both unoptimized and
|
|
|
|
|
optimized'''
|
|
|
|
|
print "Running test: \033[35;1m%s\033[0m" % testname
|
|
|
|
|
|
|
|
|
|
query=None;expr=None;o_query=None;o_expr=None
|
|
|
|
|
result_rel=None
|
|
|
|
|
result=None
|
|
|
|
|
o_result=None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
result_rel=relation.relation('%s%s.result' % (tests_path,testname))
|
|
|
|
|
|
|
|
|
|
query=readfile('%s%s.query' % (tests_path,testname)).strip()
|
|
|
|
@ -136,7 +147,8 @@ def run_test(testname):
|
|
|
|
|
if (o_result==result_rel) and (result==result_rel):
|
|
|
|
|
print "\033[32;1mTest passed\033[0m"
|
|
|
|
|
return True
|
|
|
|
|
else:
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
|
print "\033[31;1mERROR\033[0m"
|
|
|
|
|
print "Query: %s -> %s" % (query,expr)
|
|
|
|
|
print "Optimized query: %s -> %s" % (o_query,o_expr)
|
|
|
|
@ -147,12 +159,12 @@ def run_test(testname):
|
|
|
|
|
print result
|
|
|
|
|
print "\033[33;1mOptimized result\033[0m"
|
|
|
|
|
print o_result
|
|
|
|
|
print "\033[33;1mResult and optimized result match\033[0m", result==o_result
|
|
|
|
|
print "\033[33;1moptimized result match\033[0m", result_rel==o_result
|
|
|
|
|
print "\033[33;1mresult match \033[0m", result==result_rel
|
|
|
|
|
print "\033[31;1m=====================================\033[0m"
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
print "-> Starting testsuite for relational"
|
|
|
|
|
load_relations()
|
|
|
|
|