13from os.path
import isfile, join
25 assert(request.status_code == 200)
30 with open(path,
'wb+')
as fd:
31 json.dump(request.json(), fd, sort_keys=
True, indent=2,
32 separators=(
',',
': '))
36 with open(path,
'wb+')
as fd:
37 fd.write(request.content)
51 self.
skp = skp_dir +
'/' + skp_name
55 return Check(requests.get(self.
url +
'/info'))
58 with open(self.
skp,
'rb')
as payload:
59 files = {
'file': payload}
62 return Check(requests.post(self.
url +
'/new', files=files))
70 url = self.
url +
'/img/' + str(opcount)
75 return Check(requests.post(self.
url +
'/enableGPU/1'))
78 return Check(requests.post(self.
url +
'/enableGPU/0'))
82 return len(r.json()[
'commands']) - 1
89 parser = argparse.ArgumentParser(description=
'Tester for SkiaServe')
90 parser.add_argument(
'--skp_dir', default=
'skps', type=str)
91 parser.add_argument(
'--url', default=
'http://localhost:8888', type=str)
92 parser.add_argument(
'--output_dir', default=
'results', type=str)
93 parser.add_argument(
'--match', default=
'.*', type=str)
94 parser.add_argument(
'--ops', nargs=
'+', default=default_ops)
96 args = parser.parse_args()
97 skp_dir = args.skp_dir
99 output_dir = args.output_dir
102 if not os.path.isdir(output_dir):
103 os.makedirs(output_dir)
106 for skp
in listdir(skp_dir):
107 if isfile(
join(skp_dir, skp))
and re.match(args.match, skp):
112 for skp_name
in skps:
113 tester.set_skp(skp_dir, skp_name)
115 getattr(tester, op)()
117if __name__ ==
"__main__":
def set_skp(self, skp_dir, skp_name)
def __init__(self, url, output_dir)
def WritePng(request, path)
def WriteJson(request, path)
static SkString join(const CommandLineFlags::StringArray &)