Migrate and remove test/apps submodule

We decided to merge the sample app integrations submodule back because
working with git submodules turned out to be really painful. The only
blocker for this was the fact, that previously it contained a lot of
binary blobs and copy-pasted sources, but this was cleaned up recently.

Credits: (authors of particular integration examples, extracted from
commits and PR history in https://github.com/oscarlab/graphene-tests)

apache:     Chia-Che Tsai <chiache@tamu.edu>, Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
bash:       Chia-Che Tsai <chiache@tamu.edu>, Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
blender:    borysp <borysp@invisiblethingslab.com>
busybox:    borysp <borysp@invisiblethingslab.com>
capnproto:  Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
curl:       Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
gcc:        Thomas Knauth <thomas.knauth@intel.com>
lighttpd:   Chia-Che Tsai <chiache@tamu.edu>, Thomas Knauth <thomas.knauth@intel.com>
lmbench:    Chia-Che Tsai <chiache@tamu.edu>
memcached:  Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
nginx:      Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
nodejs:     jack.wxz <jack.wxz@alibaba-inc.com>
nodejs-express-server: Eduardo Rodriguez <erodrig@us.ibm.com>
openvino:   Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
python-scipy-insecure: Chia-Che Tsai <chiache@tamu.edu>, Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
python-simple:         Chia-Che Tsai <chiache@tamu.edu>, Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
pytorch:    Thomas Knauth <thomas.knauth@intel.com>
r:          Chia-Che Tsai <chiache@tamu.edu>
redis:      Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
tensorflow: Thomas Knauth <thomas.knauth@intel.com>

LTP was moved to LibOS/shim/test/ltp. It was recently rewritten by
Wojtek Porczyk <woju@invisiblethingslab.com>.
This commit is contained in:
Michał Kowalczyk
2020-03-30 21:10:41 +02:00
parent 6bec83c033
commit 6c7ff2d3a6
138 changed files with 32830 additions and 1 deletions
+116
View File
@@ -0,0 +1,116 @@
"""
Downloaded from https://code.google.com/p/benchrun/
A benchmark is defined by creating a subclass of Benchmark.
The subclass should define a method run() that executes the code
to be timed and returns the elapsed time in seconds (as a float),
or None if the benchmark should be skipped.
See fibonacci.py for example.
"""
import sys
if sys.platform == 'win32':
from time import clock
else:
from time import time as clock
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/302478
def combinations(*seqin):
def rloop(seqin,comb):
if seqin:
for item in seqin[0]:
newcomb = comb + [item]
for item in rloop(seqin[1:],newcomb):
yield item
else:
yield comb
return rloop(seqin,[])
class Benchmark:
sort_by = []
reference = None
def __init__(self):
self.pnames = []
self.pvalues = []
self.results = []
self.results_dict = {}
for pname in self.parameters:
value = getattr(self, pname)
self.pnames.append(pname)
self.pvalues.append(value)
self.pcombos = list(combinations(*self.pvalues))
if self.reference:
self.reference_param = self.reference[0]
self.reference_value = self.reference[1]
def time_all(self):
"""Run benchmark for all versions and parameters."""
for params in self.pcombos:
args = dict(zip(self.pnames, params))
t = self.run(**args)
self.results.append(tuple(params) + (t,))
self.results_dict[tuple(params)] = t
def sort_results(self):
sort_keys = []
for name in self.sort_by:
sort_keys += [self.pnames.index(name)]
for i, name in enumerate(self.pnames):
if i not in sort_keys:
sort_keys += [i]
def key(v):
return list(v[i] for i in sort_keys)
self.results.sort(key=key)
def get_factor(self, pvalues, time):
if not self.reference or not time:
return None
pvalues = list(pvalues)
i = self.pnames.index(self.reference_param)
if pvalues[i] == self.reference_value:
return None
else:
pvalues[i] = self.reference_value
ref = self.results_dict[tuple(pvalues)]
if ref == None:
return None
return ref / time
def print_result(self):
"""Run benchmark for all versions and parameters and print results
in tabular form to the standard output."""
self.time_all()
self.sort_results()
print("=" * 78)
print()
print(self.__class__.__name__)
print(self.__doc__ + "\n")
colwidth = 15
reftimes = {}
ts = "seconds"
if self.reference:
ts += " (x faster than " + (str(self.reference_value)) + ")"
print(" " + " ".join([str(r).ljust(colwidth) for r in self.pnames + [ts]]))
print("-" * 79)
rows = []
for vals in self.results:
pvalues = vals[:-1]
time = vals[-1]
if time == None:
stime = "(n/a)"
else:
stime = "%.8f" % time
factor = self.get_factor(pvalues, time)
if factor != None:
stime += (" (%.2f)" % factor)
vals = pvalues + (stime,)
row = [str(val).ljust(colwidth) for val in vals]
print(" " + " ".join(row))
print()
@@ -0,0 +1,54 @@
#!/usr/bin/env python3
"""
Very simple HTTP server in python.
Downloaded from: https://gist.github.com/bradmontgomery/2219997
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost
Send a HEAD request::
curl -I http://localhost
Send a POST request::
curl -d "foo=bar&bin=baz" http://localhost
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import socketserver
class S(BaseHTTPRequestHandler):
def _set_headers(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
def do_GET(self):
self._set_headers()
self.wfile.write("<html><body><h1>hi!</h1></body></html>".encode())
def do_HEAD(self):
self._set_headers()
def do_POST(self):
# Doesn't do anything with posted data
self._set_headers()
self.wfile.write("<html><body><h1>POST!</h1></body></html>".encode())
def run(server_class=HTTPServer, handler_class=S, port=80):
server_address = ('', port)
httpd = server_class(server_address, handler_class)
print('Starting httpd...')
httpd.serve_forever()
if __name__ == "__main__":
from sys import argv
if len(argv) == 2:
run(port=int(argv[1]))
else:
run()
@@ -0,0 +1,54 @@
"""
Downloaded from https://code.google.com/p/benchrun/
Fibonacci numbers test benchmark
"""
from benchrun import Benchmark, clock
def fib1(n):
if n < 2:
return n
return fib1(n-1) + fib1(n-2)
def fib2(n):
if n < 2:
return n
a, b = 1, 0
for i in range(n-1):
a, b = a+b, a
return a
class FibonacciBenchmark(Benchmark):
"""Compare time to compute the nth Fibonacci number recursively
(fib1) and iteratively (fib2)."""
# Execute for all combinations of these parameters
parameters = ['version', 'n']
version = ['fib1', 'fib2']
n = range(0, 60, 5)
# Compare timings against this parameter value
reference = ('version', 'fib1')
def run(self, n, version):
f = globals()[version]
# Don't repeat when slow
if version == 'fib1' and n > 10:
# Skip altogether
if n > 30:
return None
t1 = clock()
f(n)
t2 = clock()
return t2-t1
# Need to repeat many times to get accurate timings for small n
else:
t1 = clock()
f(n); f(n); f(n); f(n); f(n); f(n); f(n)
f(n); f(n); f(n); f(n); f(n); f(n); f(n)
t2 = clock()
return (t2 - t1) / 14
if __name__ == '__main__':
FibonacciBenchmark().print_result()
@@ -0,0 +1,3 @@
#!/usr/bin/env python3
print("Hello World")
@@ -0,0 +1,14 @@
#!/usr/bin/env python3
import sys
import urllib.request
request = urllib.request.Request("http://" + sys.argv[1] + ":" + sys.argv[2] + "/index.html")
opener = urllib.request.build_opener()
response = opener.open(request, timeout=10)
while True:
data = response.read(1024)
if data:
print(data.decode())
else:
break