THRIFT-2578 Moving 'make cross' from test.sh to test.py
diff --git a/test/test.py b/test/test.py
index 00d2d0d..0068c81 100644
--- a/test/test.py
+++ b/test/test.py
@@ -60,14 +60,16 @@
   server_args = []
   cli_args = []
   if server_lib == 'java':
-    server_executable[2] = relfile(server_executable[2])
-    server_args.extend(server_executable)
+    server_args.append(server_executable[0])
+    server_args.append(server_executable[1])
+    server_args.append(relfile(server_executable[2]))
     server_args.extend(['-Dtestargs','\"'])
   else:
     server_args = [relfile(server_executable)]
   if client_lib == 'java':
-    client_executable[2] = relfile(client_executable[2])
-    cli_args.extend(client_executable)
+    cli_args.append(client_executable[0])
+    cli_args.append(client_executable[1])
+    cli_args.append(relfile(client_executable[2]))
     cli_args.extend(['-Dtestargs','\"'])
   else:
     cli_args = [relfile(client_executable)]
@@ -96,8 +98,8 @@
   server_args.extend(server_extra_args)
   cli_args.extend(client_extra_args)
 
-  server_log=open("log/" + test_name + "_server.log","a")
-  client_log=open("log/" + test_name + "_client.log","a")
+  server_log=open(relfile("log/" + test_name + "_server.log"),"a")
+  client_log=open(relfile("log/" + test_name + "_client.log"),"a")
 
   try:
     if options.verbose > 0:
@@ -169,8 +171,8 @@
              'processes to terminate via alarm'
              % (protocol, use_zlib, use_ssl, extra_sleep))
       time.sleep(extra_sleep)
-    os.kill(serverproc.pid, signal.SIGKILL)
-    serverproc.wait()
+    os.kill(serverproc.pid, signal.SIGTERM)
+    #serverproc.wait()
   client_log.flush()
   server_log.flush()
   client_log.close()
@@ -178,14 +180,15 @@
 
 test_count = 0
 failed = 0
+hard_fail_count = 0
 platform = platform.system()
-if os.path.exists('log'): shutil.rmtree('log')
-os.makedirs('log')
-if os.path.exists('results.json'): os.remove('results.json')
-results_json = open("results.json","a")
+if os.path.exists(relfile('log')): shutil.rmtree(relfile('log'))
+os.makedirs(relfile('log'))
+if os.path.exists(relfile('results.json')): os.remove(relfile('results.json'))
+results_json = open(relfile("results.json"),"a")
 results_json.write("[\n")
 
-with open('tests.json') as data_file:
+with open(relfile('tests.json')) as data_file:
     data = json.load(data_file)
 
 #subprocess.call("export NODE_PATH=../lib/nodejs/test:../lib/nodejs/lib:${NODE_PATH}")
@@ -217,6 +220,8 @@
                   ret = runServiceTest(test_name, server_lib, server_executable, server_extra_args, client_lib, client_executable, client_extra_args, protocol, protocol, transport, 9090, 0, sock)
                   if ret != None:
                     failed += 1
+                    if client["exit"] == "hard" and server["exit"] == "hard":
+                      hard_fail_count +=1
                     print "Error: %s" % ret
                     print "Using"
                     print (' Server: %s --protocol=%s --transport=%s %s %s'
@@ -240,6 +245,8 @@
 
                   if ret != None:
                     failed += 1
+                    if client["exit"] == "hard" and server["exit"] == "hard":
+                      hard_fail_count +=1
                     print "Error: %s" % ret
                     print "Using"
                     print (' Server: %s --protocol=%s --transport=%s %s %s'
@@ -262,6 +269,8 @@
                   ret = runServiceTest(test_name, server_lib,server_executable, server_extra_args, client_lib, client_executable, client_extra_args, protocol, 'binary', transport, 9090, 0, sock)
                   if ret != None:
                     failed += 1
+                    if client["exit"] == "hard" and server["exit"] == "hard":
+                      hard_fail_count +=1
                     print "Error: %s" % ret
                     print "Using"
                     print (' Server: %s --protocol=%s --transport=%s %s %s'
@@ -276,4 +285,5 @@
 results_json.write("\n]")
 results_json.flush()
 results_json.close()
-print '%s failed of %s tests in total' % (failed, test_count)
\ No newline at end of file
+print '%s failed of %s tests in total' % (failed, test_count)
+sys.exit(hard_fail_count)
\ No newline at end of file