From 99f8695bf53f75a57895570e0fed4beac274e0e8 Mon Sep 17 00:00:00 2001 From: Matt Klein Date: Sat, 25 Mar 2017 10:07:28 -0700 Subject: [PATCH 1/2] test: setup script refactor Slight refactor to allow setup scripts to be also called from private code. --- test/config/integration/gen_test_configs.sh | 2 -- test/run_envoy_tests.sh | 10 +--------- test/setup_test_env.sh | 12 ++++++++++++ 3 files changed, 13 insertions(+), 11 deletions(-) create mode 100755 test/setup_test_env.sh diff --git a/test/config/integration/gen_test_configs.sh b/test/config/integration/gen_test_configs.sh index 13702d7bb139a..fa284748b52f3 100755 --- a/test/config/integration/gen_test_configs.sh +++ b/test/config/integration/gen_test_configs.sh @@ -8,8 +8,6 @@ set -e CONFIG_IN_DIR=$1 CONFIG_OUT_DIR=$2 -mkdir -p "${CONFIG_OUT_DIR}" - for f in $(find "${CONFIG_IN_DIR}" -name "*.json"); do cat $f | sed -e "s#{{ test_tmpdir }}#$TEST_TMPDIR#g" | \ diff --git a/test/run_envoy_tests.sh b/test/run_envoy_tests.sh index 998ec880f81c1..794d6b9f2dea0 100755 --- a/test/run_envoy_tests.sh +++ b/test/run_envoy_tests.sh @@ -5,15 +5,7 @@ set -e SOURCE_DIR=$1 BINARY_DIR=$2 -# These directories have the Bazel meaning described at -# https://bazel.build/versions/master/docs/test-encyclopedia.html. In particular, TEST_SRCDIR is -# where we expect to find the generated outputs of various scripts preparing input data (these are -# not only the actual source files!). -: ${TEST_TMPDIR:=/tmp/envoy_test_tmp} -: ${TEST_SRCDIR:=/tmp/envoy_test_runfiles} -export TEST_TMPDIR TEST_SRCDIR - -mkdir -p $TEST_TMPDIR +source $SOURCE_DIR/test/setup_test_env.sh $SOURCE_DIR/test/certs/gen_test_certs.sh $TEST_SRCDIR/test/certs $SOURCE_DIR/test/config/integration/gen_test_configs.sh $SOURCE_DIR/test/config/integration \ diff --git a/test/setup_test_env.sh b/test/setup_test_env.sh new file mode 100755 index 0000000000000..e18f8aa3832d2 --- /dev/null +++ b/test/setup_test_env.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# These directories have the Bazel meaning described at +# https://bazel.build/versions/master/docs/test-encyclopedia.html. In particular, TEST_SRCDIR is +# where we expect to find the generated outputs of various scripts preparing input data (these are +# not only the actual source files!). +: ${TEST_TMPDIR:=/tmp/envoy_test_tmp} +: ${TEST_SRCDIR:=/tmp/envoy_test_runfiles} +export TEST_TMPDIR TEST_SRCDIR + +mkdir -p $TEST_TMPDIR +mkdir -p $TEST_SRCDIR From 1df9b08cb9f19f8d4bb0687452c62018a8d2a73e Mon Sep 17 00:00:00 2001 From: Matt Klein Date: Sat, 25 Mar 2017 14:21:26 -0700 Subject: [PATCH 2/2] fix --- test/config/integration/gen_test_configs.sh | 2 ++ test/run_envoy_tests.sh | 2 ++ test/setup_test_env.sh | 3 --- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/config/integration/gen_test_configs.sh b/test/config/integration/gen_test_configs.sh index fa284748b52f3..13702d7bb139a 100755 --- a/test/config/integration/gen_test_configs.sh +++ b/test/config/integration/gen_test_configs.sh @@ -8,6 +8,8 @@ set -e CONFIG_IN_DIR=$1 CONFIG_OUT_DIR=$2 +mkdir -p "${CONFIG_OUT_DIR}" + for f in $(find "${CONFIG_IN_DIR}" -name "*.json"); do cat $f | sed -e "s#{{ test_tmpdir }}#$TEST_TMPDIR#g" | \ diff --git a/test/run_envoy_tests.sh b/test/run_envoy_tests.sh index 794d6b9f2dea0..ed9237f7aa59d 100755 --- a/test/run_envoy_tests.sh +++ b/test/run_envoy_tests.sh @@ -7,6 +7,8 @@ BINARY_DIR=$2 source $SOURCE_DIR/test/setup_test_env.sh +mkdir -p $TEST_TMPDIR + $SOURCE_DIR/test/certs/gen_test_certs.sh $TEST_SRCDIR/test/certs $SOURCE_DIR/test/config/integration/gen_test_configs.sh $SOURCE_DIR/test/config/integration \ $TEST_SRCDIR/test/config/integration diff --git a/test/setup_test_env.sh b/test/setup_test_env.sh index e18f8aa3832d2..1fe0ad38e9391 100755 --- a/test/setup_test_env.sh +++ b/test/setup_test_env.sh @@ -7,6 +7,3 @@ : ${TEST_TMPDIR:=/tmp/envoy_test_tmp} : ${TEST_SRCDIR:=/tmp/envoy_test_runfiles} export TEST_TMPDIR TEST_SRCDIR - -mkdir -p $TEST_TMPDIR -mkdir -p $TEST_SRCDIR