From 34a640655b9fc493a5e09570802ef3fe9e5d83ac Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sat, 21 Jul 2018 20:04:34 +0200 Subject: export os.environ to subprocesses --- bench_conprod.py | 5 ++++- bench_loop.py | 5 ++++- bench_mysql.py | 8 +++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/bench_conprod.py b/bench_conprod.py index 0ad43ed..31c4d2e 100644 --- a/bench_conprod.py +++ b/bench_conprod.py @@ -59,7 +59,10 @@ class Benchmark_ConProd( Benchmark ): if verbose: print("\n" + tname, t, "\n", " ".join(target_cmd), "\n") - p = subprocess.Popen(target_cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE, + p = subprocess.Popen(target_cmd, + env=os.environ, + stderr=subprocess.PIPE, + stdout=subprocess.PIPE, universal_newlines=True) while p.poll() == None: diff --git a/bench_loop.py b/bench_loop.py index c0162e3..482e97c 100644 --- a/bench_loop.py +++ b/bench_loop.py @@ -60,7 +60,10 @@ class Benchmark_Loop( Benchmark ): if verbose: print("\n" + tname, t, "\n", " ".join(target_cmd), "\n") - p = subprocess.Popen(target_cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE, + p = subprocess.Popen(target_cmd, + env=os.environ, + stderr=subprocess.PIPE, + stdout=subprocess.PIPE, universal_newlines=True) while p.poll() == None: diff --git a/bench_mysql.py b/bench_mysql.py index 531d45f..6bab4e2 100644 --- a/bench_mysql.py +++ b/bench_mysql.py @@ -16,12 +16,13 @@ from common_targets import common_targets cwd = os.getcwd() prepare_cmd = ("sysbench oltp_read_only --db-driver=mysql --mysql-user=root " - "--mysql-socket="+cwd+"/mysql_test/socket --table-size=1000000 prepare").split(" ") + "--mysql-socket="+cwd+"/mysql_test/socket --table-size=1000000 prepare").split() cmd = ("sysbench oltp_read_only --threads={} --time=10 " "--db-driver=mysql --mysql-user=root --mysql-socket={}/mysql_test/socket run") -server_cmd = "mysqld -h {0}/mysql_test --socket={0}/mysql_test/socket".format(cwd).split(" ") +server_cmd = ("mysqld -h {0}/mysql_test --socket={0}/mysql_test/socket " + "--secure-file-priv=").format(cwd).split() class Benchmark_MYSQL( Benchmark ): @@ -41,7 +42,7 @@ class Benchmark_MYSQL( Benchmark ): log = os.devnull with open(log, "ab") as f: - self.server = subprocess.Popen(server_cmd, + self.server = subprocess.Popen(server_cmd, env=os.environ, stdout=f, stderr=f, universal_newlines=True) @@ -61,6 +62,7 @@ class Benchmark_MYSQL( Benchmark ): stdout=devnull, stderr=devnull) ret = ret and p.returncode == 0 if not ret: + print(p.stderr) return ret if not self.start_and_wait_for_server(None, verbose, "mysqld.log"): -- cgit v1.2.3