|
@@ -139,48 +139,10 @@ def run_file(files, parameters, expected, mode):
|
|
|
if val != 0:
|
|
|
raise Exception("Linking error")
|
|
|
|
|
|
- # Send in the actual request and wait for replies
|
|
|
- var_list = {}
|
|
|
- data = []
|
|
|
- got_output = []
|
|
|
- for p in parameters:
|
|
|
- if isinstance(p, int):
|
|
|
- if p not in var_list:
|
|
|
- data = flush_data(address, data)
|
|
|
-
|
|
|
- proc.poll()
|
|
|
- if proc.returncode is not None:
|
|
|
- # Modelverse has already terminated, which isn't a good sign!
|
|
|
- return False
|
|
|
-
|
|
|
- while 1:
|
|
|
- val = urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "get_output", "username": username})), timeout=120).read()
|
|
|
- l, r = val.split("&", 1)
|
|
|
- if l.startswith("id"):
|
|
|
- id_str = l
|
|
|
- val_str = r
|
|
|
- else:
|
|
|
- id_str = r
|
|
|
- val_str = l
|
|
|
- id_val = id_str.split("=", 1)[1]
|
|
|
- val_val = val_str.split("=", 1)[1]
|
|
|
-
|
|
|
- if val_val == "None":
|
|
|
- var_list[p] = id_val
|
|
|
- break
|
|
|
- else:
|
|
|
- got_output.append(val)
|
|
|
- continue
|
|
|
- else:
|
|
|
- val = var_list[p]
|
|
|
- t = "R"
|
|
|
- else:
|
|
|
- val = p
|
|
|
- t = "V"
|
|
|
- data.append([t, val])
|
|
|
- data = flush_data(address, data)
|
|
|
- flush_data(address, data)
|
|
|
+ # Send the request ...
|
|
|
+ flush_data(address, parameters)
|
|
|
|
|
|
+ # ... and wait for replies
|
|
|
for e in expected:
|
|
|
c = len(e) if isinstance(e, set) else 1
|
|
|
for _ in range(c):
|
|
@@ -193,7 +155,6 @@ def run_file(files, parameters, expected, mode):
|
|
|
# Modelverse has already terminated, which isn't a good sign!
|
|
|
raise Exception("Modelverse died!")
|
|
|
|
|
|
- val = val.split("=", 2)[2]
|
|
|
print("Got %s, expect %s" % (val, e))
|
|
|
if isinstance(e, set):
|
|
|
assert str(val) in e
|
|
@@ -241,31 +202,8 @@ def run_barebone(parameters, expected, interface="0", timeout=False, wait=False,
|
|
|
if time.time() - start > timeout_val:
|
|
|
raise
|
|
|
|
|
|
- # Send in the actual request and wait for replies
|
|
|
- var_list = {}
|
|
|
- data = []
|
|
|
- for p in parameters:
|
|
|
- if isinstance(p, int):
|
|
|
- if p not in var_list:
|
|
|
- data = flush_data(address, data)
|
|
|
-
|
|
|
- proc.poll()
|
|
|
- if proc.returncode is not None:
|
|
|
- # Modelverse has already terminated, which isn't a good sign!
|
|
|
- return False
|
|
|
-
|
|
|
- val = urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "get_output", "username": username})), timeout=10).read()
|
|
|
- val = val.split("=", 2)[1].split("&", 1)[0]
|
|
|
- var_list[p] = val
|
|
|
- continue
|
|
|
- else:
|
|
|
- val = var_list[p]
|
|
|
- t = "R"
|
|
|
- else:
|
|
|
- val = p
|
|
|
- t = "V"
|
|
|
- data.append([t, val])
|
|
|
- data = flush_data(address, data)
|
|
|
+ # Send the request
|
|
|
+ flush_data(address, parameters)
|
|
|
|
|
|
# Now do linking and loading
|
|
|
if link is not None:
|
|
@@ -285,7 +223,6 @@ def run_barebone(parameters, expected, interface="0", timeout=False, wait=False,
|
|
|
# Modelverse has already terminated, which isn't a good sign!
|
|
|
return False
|
|
|
|
|
|
-
|
|
|
for inp in inputs:
|
|
|
urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "set_input", "element_type": "V", "value": inp, "username": username})), timeout=1).read()
|
|
|
proc.poll()
|
|
@@ -310,7 +247,6 @@ def run_barebone(parameters, expected, interface="0", timeout=False, wait=False,
|
|
|
return True
|
|
|
else:
|
|
|
raise
|
|
|
- val = val.split("=", 2)[2]
|
|
|
|
|
|
print("Got %s, expect %s" % (val, e))
|
|
|
if isinstance(e, set):
|