summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/xkeyboard-config-test.py.in33
1 files changed, 22 insertions, 11 deletions
diff --git a/test/xkeyboard-config-test.py.in b/test/xkeyboard-config-test.py.in
index 001f1b6..8c02125 100755
--- a/test/xkeyboard-config-test.py.in
+++ b/test/xkeyboard-config-test.py.in
@@ -8,7 +8,7 @@ import xml.etree.ElementTree as ET
from multiprocessing import Pool
-verbose = True
+verbose = False
DEFAULT_RULES_XML = '@XKB_CONFIG_ROOT@/rules/evdev.xml'
@@ -17,20 +17,24 @@ EXTRA_PATH = '@MESON_BUILD_ROOT@'
os.environ['PATH'] = ':'.join([EXTRA_PATH, os.getenv('PATH')])
-def noop_progress_bar(x, total):
- return x
+def escape(s):
+ return s.replace('"', '\\"')
# The function generating the progress bar (if any).
-progress_bar = noop_progress_bar
-if os.isatty(sys.stdout.fileno()):
- try:
- from tqdm import tqdm
- progress_bar = tqdm
+def create_progress_bar(verbose):
+ def noop_progress_bar(x, total):
+ return x
- verbose = False
- except ImportError:
- pass
+ progress_bar = noop_progress_bar
+ if not verbose and os.isatty(sys.stdout.fileno()):
+ try:
+ from tqdm import tqdm
+ progress_bar = tqdm
+ except ImportError:
+ pass
+
+ return progress_bar
def xkbcommontool(rmlvo):
@@ -172,6 +176,9 @@ def run(combos, tool, njobs):
def main(args):
+ global progress_bar
+ global verbose
+
tools = {
'libxkbcommon': xkbcommontool,
'xkbcomp': xkbcomp,
@@ -190,8 +197,12 @@ def main(args):
parser.add_argument('--jobs', '-j', type=int,
default=os.cpu_count() * 4,
help='number of processes to use')
+ parser.add_argument('--verbose', '-v', default=False, action="store_true")
args = parser.parse_args()
+ verbose = args.verbose
+ progress_bar = create_progress_bar(verbose)
+
tool = tools[args.tool]
combos = parse(args.path)