/usr/lib/2013.com.canonical.certification:checkbox/bin/glob_test is in plainbox-provider-checkbox 0.4-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | #!/usr/bin/python
from Globs import benchmarks, hwd
import argparse
import locale
import logging
import sys
import os
#Magic to override the _ function from gettext, since
#it's overkill for our needs here.
def underscore(string, *args, **kwargs):
return(string)
__builtins__._ = underscore
class Application:
def __init__(self, share_dir='', bench_dir='', width=800, height=600,
time=5, repetitions=1, fullscreen=False, min_fps=60,
ignore_problems=False):
self.opts= {}
self.opts['width'] = width
self.opts['height'] = height
self.opts['time'] = time
self.opts['repetitions'] = repetitions
self.opts['fullscreen'] = fullscreen
self.min_fps = min_fps
self.ignore_problems = ignore_problems
self.share_dir = share_dir
self.bench_dir = bench_dir
def run(self):
test_pass = True
self.hwd = hwd.HWDetect()
self.bm = benchmarks.Benchmarks(os.path.join(self.bench_dir,
'benchmarks'))
ver_str = self.hwd.get_gl_info()['version']
hwd_ext = self.hwd.get_gl_info()['extensions']
bench_list = [name for name in self.bm.get_names() if name != 'Fake']
for benchmark_name in bench_list :
runnable = True
if self.bm.check_ver(benchmark_name, ver_str) == False:
logging.warning("%s requires OpenGL version %s, I have %s",
benchmark_name,
self.bm.get_info(benchmark_name)['glversion'],
ver_str)
runnable = False
test_pass = False
ext_list = self.bm.check_ext(benchmark_name, hwd_ext)
if ext_list.__class__ == list: # Returned a list of missing exts
missing_ext = ''
for ext in ext_list:
missing_ext += ext
if ext_list.index(ext) != len(ext_list) - 1:
missing_ext += ', '
logging.warning("Missing extensions: %s",missing_ext)
runnable = False
test_pass = False
if runnable:
fps = self.bm.run(benchmark_name, self.opts)
if fps is None:
#oops, test failed to produce usable result!
print("Test failed to produce FPS measurement.")
print("Possible causes: OpenGL version too low/high")
if self.ignore_problems:
print("Ignoring this as requested")
else:
print("Considering this a FAIL test")
test_pass = False
else:
print("{} {} fps".format(benchmark_name, fps))
if ( self.min_fps > fps):
print("(Failed to meet minimum {} FPS)".format(
self.min_fps))
test_pass = False
return test_pass
share_dir = '/usr/share/globs'
locale_dir = '/usr/share/locale'
bench_dir = '/usr/lib/globs'
parser = argparse.ArgumentParser("Executes gl benchmarks non-interactively")
parser.add_argument("--width", action='store',
default=800, type=int)
parser.add_argument("--height", action='store',
default=600, type=int)
parser.add_argument("--repetitions", action='store',
default=1, type=int)
parser.add_argument("--time", action='store',
default=10, type=int)
parser.add_argument("--ignore-problems", action='store_true',
default=False, help=("If a test fails to "
"produce a FPS rating, ignore it for global test "
"outcome purposes"))
parser.add_argument("--fullscreen", action='store_true',
default=False)
parser.add_argument("--min-fps", action='store',
default=60.0, type=float, help=("If any of the benchmarks"
"obtains less than this FPS, the test will be considered"
"failed"))
args = parser.parse_args()
app = Application(share_dir, bench_dir, args.width, args.height,
args.time, args.repetitions, args.fullscreen, args.min_fps,
args.ignore_problems)
if app.run():
print("PASS")
sys.exit(0)
else:
print("FAIL")
sys.exit(1)
|