summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2020-03-27 16:54:09 +0100
committerStefan Schmidt <s.schmidt@samsung.com>2020-03-31 14:56:36 +0200
commit2f9caff972a7fe2890a254feb1d8a86946e7e131 (patch)
treeccbc7c2f4f2c89b7fee2962e5a8cd67a1b94a83c
parent7466ca4de7a8be1b16163ec8fdceaf474c559ed4 (diff)
exactness_play: introduce runner script
this is just a little python script, so you can lunch exactness_play without the need of handdefining LD_PRELOAD Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D11616
-rw-r--r--src/bin/exactness/exactness_play.in96
-rw-r--r--src/bin/exactness/meson.build8
2 files changed, 104 insertions, 0 deletions
diff --git a/src/bin/exactness/exactness_play.in b/src/bin/exactness/exactness_play.in
new file mode 100644
index 0000000000..650826f871
--- /dev/null
+++ b/src/bin/exactness/exactness_play.in
@@ -0,0 +1,96 @@
1#!/usr/bin/env python3
2
3import argparse
4import subprocess
5import os
6
7parser = argparse.ArgumentParser(description='A scenario recorder for EFL based applications.'
8 '\tF1 - Request stabilization\n'
9 '\tF2 - Request shot\n'
10 '\tF3 - Request to save the scenario\n')
11parser.add_argument('app', metavar='app', help='The app to run. You can also pass environment variables here.', type=str, nargs='*')
12parser.add_argument('-o', '--output', metavar='output', help=" Set the destination for the shots.\n"
13 " If a .exu is given, the shots are stored in the file.\n"
14 " Otherwise the given path is considered as a directory\n"
15 " where shots will be stored.\n"
16 " If omitted, the output type (exu or dir) is determined\n"
17 " by the given test extension (resp. exu or rec).", type=str)
18parser.add_argument('-t', '--tests', metavar='tests', help='Name of the filename where to store the test.', type=str)
19parser.add_argument('-s', '--show-on-screen', help='Show on screen', action='store_true', default=False)
20parser.add_argument('--scan-objects', help='Extract information of all the objects at every shot.', action='store_true')
21parser.add_argument('--external-injection', help='Expect events injection via Eina debug channel.', action='store_true')
22parser.add_argument('--disable-screenshots', help='Disable screenshots.', action='store_true')
23parser.add_argument('-f', '--fontsdir', metavar='fontsdir', help='Specify a directory of the fonts that should be used.', type=str)
24parser.add_argument('--stabilize-shots', help='Wait for the frames to be stable before taking the shots.', action='store_true')
25parser.add_argument('--speed', metavar='speed', help='Set the speed used to play the given test (default 1.0).', type=float, default=1.0)
26parser.add_argument('-v', '--verbose', help='Turn verbose messages on', action='store_true')
27parser.add_argument('-L', '--license', help='the path where to find the meson build directory', action='store_true')
28parser.add_argument('-C', '--copyright', help='the path where to find the meson build directory', action='store_true')
29parser.add_argument('-V', '--version', help='the path where to find the meson build directory', action='store_true')
30
31G = parser.parse_args()
32
33if G.license:
34 print("BSD.")
35 exit(0)
36
37if G.copyright:
38 print("(C) 2017 Enlightenment.")
39 exit(0)
40
41if G.version:
42 print(@VERSION@)
43 exit(0)
44
45spawn_env = os.environ.copy()
46spawn_env["LD_PRELOAD"] = @EXACTNESS_PLAY_PRELOAD_PATH@
47
48if G.tests == None and G.external_injection == True:
49 print("no test file specified")
50 exit(-1)
51if G.tests != None and G.external_injection == True:
52 print("Cannot inject events from a source file and from outside simultaneously")
53 exit(-1)
54if G.scan_objects == True and G.tests.endswith(".exu"):
55 printf("Scan objects options is available only if the destination is a EXU file")
56 exit(-1)
57
58if G.output != None:
59 spawn_env["EXACTNESS_DEST"] = G.output;
60if G.external_injection:
61 spawn_env["EXACTNESS_EXTERNAL_INJECTION"] = "Yes"
62if G.tests != None:
63 spawn_env["EXACTNESS_SRC"] = G.tests
64if G.fontsdir != None:
65 spawn_env["EXACTNESS_FONTS_DIR"] = G.fontsdir
66if G.speed != 1.0:
67 spawn_env["EXACTNESS_SPEED"] = G.speed
68if G.scan_objects:
69 spawn_env["EXACTNESS_SCAN_OBJECTS"] = "Yes"
70if G.disable_screenshots:
71 spawn_env["EXACTNESS_DISABLE_SHOTS"] = "Yes"
72if G.stabilize_shots:
73 spawn_env["EXACTNESS_STABILIZE_SHOTS"] = "Yes"
74if G.verbose:
75 spawn_env["EXACTNESS_VERBOSE"] = "Yes"
76if G.show_on_screen == False:
77 spawn_env["ELM_DISPLAY"] = "buffer"
78
79passed_all_the_env_vars = False
80app = []
81
82for argument in G.app:
83 if '=' not in argument:
84 passed_all_the_env_vars = True
85 else:
86 if passed_all_the_env_vars:
87 print("Error, env vars can only be specified at the beginning of the app call line")
88 exit(-1)
89 split_env_var = argument.split('=')
90 spawn_env[split_env_var[0]] = split_env_var[1]
91
92 if passed_all_the_env_vars:
93 app.append(argument)
94
95recorder = subprocess.Popen(app, env=spawn_env)
96recorder.wait()
diff --git a/src/bin/exactness/meson.build b/src/bin/exactness/meson.build
index 06561db7f7..2dcf08ca51 100644
--- a/src/bin/exactness/meson.build
+++ b/src/bin/exactness/meson.build
@@ -45,6 +45,7 @@ exactness_record_bin = library('exactness_record',
45) 45)
46 46
47exactness_env = configuration_data() 47exactness_env = configuration_data()
48exactness_env.set_quoted('EXACTNESS_PLAY_PRELOAD_PATH', exactness_play_bin.full_path())
48exactness_env.set_quoted('EXACTNESS_RECORD_PRELOAD_PATH', exactness_record_bin.full_path()) 49exactness_env.set_quoted('EXACTNESS_RECORD_PRELOAD_PATH', exactness_record_bin.full_path())
49exactness_env.set_quoted('VERSION', meson.project_version()) 50exactness_env.set_quoted('VERSION', meson.project_version())
50 51
@@ -54,3 +55,10 @@ configure_file(
54 configuration: exactness_env, 55 configuration: exactness_env,
55 install_dir: get_option('bindir'), 56 install_dir: get_option('bindir'),
56 install_mode: 'rwxr-xr-x') 57 install_mode: 'rwxr-xr-x')
58
59configure_file(
60 input: 'exactness_play.in',
61 output: 'exactness_play',
62 configuration: exactness_env,
63 install_dir: get_option('bindir'),
64 install_mode: 'rwxr-xr-x')