fix
This commit is contained in:
parent
e4de414799
commit
6e4906397c
@ -38,7 +38,8 @@ class BaseTester:
|
|||||||
raise TestException("RE")
|
raise TestException("RE")
|
||||||
result = open(join(self.solution.testing_directory, "output.txt"), "r").read().strip().replace('\r\n', '\n')
|
result = open(join(self.solution.testing_directory, "output.txt"), "r").read().strip().replace('\r\n', '\n')
|
||||||
print("got result", result)
|
print("got result", result)
|
||||||
if exists(f"solutions/{self.solution.id}/checker.sh"):
|
if exists(join(self.path, "checker.sh")):
|
||||||
|
self.solution.exec_command("chmod 777 checker.sh")
|
||||||
code = self.solution.exec_command(f"./checker.sh --expected {self.predicted} --output {result}")
|
code = self.solution.exec_command(f"./checker.sh --expected {self.predicted} --output {result}")
|
||||||
if code != 0:
|
if code != 0:
|
||||||
raise TestException("WA")
|
raise TestException("WA")
|
||||||
@ -57,6 +58,10 @@ class BaseTester:
|
|||||||
def build_command(self):
|
def build_command(self):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
@property
|
||||||
|
def path(self):
|
||||||
|
return join("solutions", str(self.solution.id))
|
||||||
|
|
||||||
def __init__(self, solution):
|
def __init__(self, solution):
|
||||||
self.solution = solution
|
self.solution = solution
|
||||||
|
|
||||||
@ -67,17 +72,17 @@ class BaseTester:
|
|||||||
def execute(self):
|
def execute(self):
|
||||||
if not exists("solutions"):
|
if not exists("solutions"):
|
||||||
mkdir("solutions")
|
mkdir("solutions")
|
||||||
mkdir("solutions/" + str(self.solution.id))
|
mkdir(self.path)
|
||||||
for file in SolutionFile.objects.filter(solution=self.solution):
|
for file in SolutionFile.objects.filter(solution=self.solution):
|
||||||
dirs = file.path.split("/")
|
dirs = file.path.split("/")
|
||||||
for i in range(len(dirs) - 1):
|
for i in range(len(dirs) - 1):
|
||||||
name = join(
|
name = join(
|
||||||
str("solutions/" + self.solution.id), "/".join(dirs[: i + 1])
|
self.path, "/".join(dirs[: i + 1])
|
||||||
)
|
)
|
||||||
if not exists(name):
|
if not exists(name):
|
||||||
mkdir(name)
|
mkdir(name)
|
||||||
with open(
|
with open(
|
||||||
join("solutions/" + str(self.solution.id), file.path), "wb"
|
join(self.path, file.path), "wb"
|
||||||
) as fs:
|
) as fs:
|
||||||
fs.write(get_bytes(file.fs_id))
|
fs.write(get_bytes(file.fs_id))
|
||||||
self.solution.result = CONSTS["testing_status"]
|
self.solution.result = CONSTS["testing_status"]
|
||||||
@ -88,11 +93,9 @@ class BaseTester:
|
|||||||
print("Container created")
|
print("Container created")
|
||||||
for file in ExtraFile.objects.filter(task=self.solution.task):
|
for file in ExtraFile.objects.filter(task=self.solution.task):
|
||||||
with open(
|
with open(
|
||||||
join("solutions/" + str(self.solution.id), file.filename), "wb"
|
join(self.path, file.filename), "wb"
|
||||||
) as fs:
|
) as fs:
|
||||||
fs.write(get_bytes(file.fs_id))
|
fs.write(get_bytes(file.fs_id))
|
||||||
for file in listdir("solutions/" + str(self.solution.id)):
|
|
||||||
call("chmod 777 " + "solutions/" + str(self.solution.id) + "/" + file)
|
|
||||||
print("Files copied")
|
print("Files copied")
|
||||||
try:
|
try:
|
||||||
self.before_test()
|
self.before_test()
|
||||||
|
Loading…
Reference in New Issue
Block a user