File: 0001-Remove-unwanted-tests.patch

package info (click to toggle)
qr-code-generator 1.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 708 kB
  • sloc: ansic: 2,058; java: 1,098; cpp: 934; python: 779; makefile: 153; xml: 99; sh: 15
file content (72 lines) | stat: -rw-r--r-- 2,523 bytes parent folder | download
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
From fc0f1adad86ea56f1cbc0d29bfe674dc05634c29 Mon Sep 17 00:00:00 2001
From: yangfl <yangfl@users.noreply.github.com>
Date: Sun, 21 Feb 2021 23:29:26 +0800
Subject: [PATCH 1/3] Remove unwanted tests

---
 python/qrcodegen-batch-test.py | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/python/qrcodegen-batch-test.py b/python/qrcodegen-batch-test.py
index ef56b76..28f99e5 100644
--- a/python/qrcodegen-batch-test.py
+++ b/python/qrcodegen-batch-test.py
@@ -24,19 +24,19 @@
 #   Software.
 # 
 
-import itertools, random, subprocess, sys, time
+import itertools, random, subprocess, sys, time, os, os.path
 if sys.version_info.major < 3:
 	raise RuntimeError("Requires Python 3+")
 
 
 CHILD_PROGRAMS = [
-	["python2", "-B", "../python/qrcodegen-worker.py"],  # Python 2 program
+	# ["python2", "-B", "../python/qrcodegen-worker.py"],  # Python 2 program
 	["python3", "-B", "../python/qrcodegen-worker.py"],  # Python 3 program
-	["java", "-cp", "../java/src/main/java", "-ea:io.nayuki.qrcodegen...", "io/nayuki/qrcodegen/QrCodeGeneratorWorker"],  # Java program
-	["node", "../typescript-javascript/qrcodegen-worker.js"],  # TypeScript program
+	# ["java", "-cp", "../java/src/main/java", "-ea:io.nayuki.qrcodegen...", "io/nayuki/qrcodegen/QrCodeGeneratorWorker"],  # Java program
+	# ["node", "../typescript-javascript/qrcodegen-worker.js"],  # TypeScript program
 	["../c/qrcodegen-worker"],  # C program
 	["../cpp/QrCodeGeneratorWorker"],  # C++ program
-	["../rust/target/debug/examples/qrcodegen-worker"],  # Rust program
+	# ["../rust/target/debug/examples/qrcodegen-worker"],  # Rust program
 ]
 
 
@@ -47,8 +47,14 @@ def main():
 	global subprocs
 	try:
 		for args in CHILD_PROGRAMS:
+			env = dict(os.environ)
+			if args[0].startswith('..'):
+				ld_path = os.path.dirname(args[0])
+				if 'LD_LIBRARY_PATH' in env:
+					ld_path += ':' + env['LD_LIBRARY_PATH']
+				env['LD_LIBRARY_PATH'] = ld_path
 			subprocs.append(subprocess.Popen(args, universal_newlines=True,
-				stdin=subprocess.PIPE, stdout=subprocess.PIPE))
+				stdin=subprocess.PIPE, stdout=subprocess.PIPE, env=env))
 	except FileNotFoundError:
 		write_all(-1)
 		raise
@@ -63,11 +69,13 @@ def main():
 		sys.exit("Error: One or more workers failed to start")
 	
 	# Do tests
-	for i in itertools.count():
+	for i in range(50):
 		print("Trial {}: ".format(i), end="")
 		do_trial()
 		print()
 
+	for proc in subprocs:
+		proc.terminate()
 
 def do_trial():
 	mode = random.randrange(4)
-- 
2.30.0