aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--test/py/lib/test_repo.py19
1 files changed, 6 insertions, 13 deletions
diff --git a/test/py/lib/test_repo.py b/test/py/lib/test_repo.py
index e3e875b..2820659 100644
--- a/test/py/lib/test_repo.py
+++ b/test/py/lib/test_repo.py
@@ -159,12 +159,8 @@ class TestRepoOutputEmpty(TestRepoOutput):
return len(output) == 0
-# Making it a bash script introduces way too much overhead with all the
-# argument expansions; it slows things down considerably.
-OUTPUT_SCRIPT_LONG = r'''#!/usr/bin/env python3
-output = {output}
-import sys
-sys.stdout.write(output)
+OUTPUT_SCRIPT_LONG = r'''#!/bin/sh -e
+dd if=/dev/urandom count={output_len_kb} bs=1024 | base64
'''
@@ -173,11 +169,6 @@ class TestRepoOutputLong(TestRepoOutput):
OUTPUT_LEN_KB = 300
- def __init__(self, *args, **kwargs):
- nb = TestRepoOutputLong.OUTPUT_LEN_KB * 1024
- self.output = base64.encodebytes(random.randbytes(nb)).decode()
- super().__init__(*args, **kwargs)
-
@staticmethod
def codename():
return 'output_long'
@@ -187,10 +178,12 @@ class TestRepoOutputLong(TestRepoOutput):
return True
def format_output_script(self):
- return OUTPUT_SCRIPT_LONG.format(output=repr(self.output))
+ output_len = TestRepoOutputLong.OUTPUT_LEN_KB
+ output_len = shlex.quote(str(output_len))
+ return OUTPUT_SCRIPT_LONG.format(output_len_kb=output_len)
def run_output_matches(self, output):
- return output.decode() == self.output
+ return len(output) > TestRepoOutputLong.OUTPUT_LEN_KB * 1024
OUTPUT_SCRIPT_NULL = r'''#!/usr/bin/env python3