aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/py/lib/test_repo.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-07-09 23:39:01 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-07-10 01:15:28 +0200
commit1823a58d64bad9977237074e38edfde0f91adf36 (patch)
tree9914b47d0394ce2a1e625258b64fa60ecfa27f79 /test/py/lib/test_repo.py
parenttest: prettier test names (diff)
downloadcimple-1823a58d64bad9977237074e38edfde0f91adf36.tar.gz
cimple-1823a58d64bad9977237074e38edfde0f91adf36.zip
test: test long CI run output
It immediately exposed a horrible bug in net.c, which is now fixed.
Diffstat (limited to '')
-rw-r--r--test/py/lib/test_repo.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/py/lib/test_repo.py b/test/py/lib/test_repo.py
index 94b6f93..3234de5 100644
--- a/test/py/lib/test_repo.py
+++ b/test/py/lib/test_repo.py
@@ -4,8 +4,10 @@
# Distributed under the MIT License.
import abc
+import base64
import logging
import os
+import random
import shlex
import shutil
@@ -137,3 +139,31 @@ class TestRepoOutputEmpty(TestRepoOutput):
def run_output_matches(self, output):
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)
+'''
+
+
+class TestRepoOutputLong(TestRepoOutput):
+ __test__ = False
+
+ 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)
+
+ def _format_output_script(self):
+ return OUTPUT_SCRIPT_LONG.format(output=repr(self.output))
+
+ def run_output_matches(self, output):
+ return output.decode() == self.output