@@ -92,7 +92,7 @@ psm::lb::get_tests() {
92
92
# ######################################
93
93
psm::lb::run_test () {
94
94
local test_name=" ${1:? ${FUNCNAME[0]} missing the test name argument} "
95
- psm::tools::print_test_flags " ${test_name} "
95
+ psm::run::finalize_test_flags " ${test_name} "
96
96
psm::tools::run_verbose python -m " tests.${test_name} " " ${PSM_TEST_FLAGS[@]} "
97
97
}
98
98
@@ -139,7 +139,7 @@ psm::security::run_test() {
139
139
PSM_TEST_FLAGS+=(" --nocheck_local_certs" )
140
140
fi
141
141
142
- psm::tools::print_test_flags " ${test_name} "
142
+ psm::run::finalize_test_flags " ${test_name} "
143
143
psm::tools::run_verbose python -m " tests.${test_name} " " ${PSM_TEST_FLAGS[@]} "
144
144
}
145
145
@@ -178,7 +178,7 @@ psm::url_map::run_test() {
178
178
PSM_TEST_FLAGS+=(
179
179
" --flagfile=config/url-map.cfg"
180
180
)
181
- psm::tools::print_test_flags " ${test_name} "
181
+ psm::run::finalize_test_flags " ${test_name} "
182
182
psm::tools::run_verbose python -m " tests.${test_name} " " ${PSM_TEST_FLAGS[@]} "
183
183
}
184
184
@@ -223,7 +223,7 @@ psm::csm::run_test() {
223
223
PSM_TEST_FLAGS+=(
224
224
" --flagfile=config/common-csm.cfg"
225
225
)
226
- psm::tools::print_test_flags " ${test_name} "
226
+ psm::run::finalize_test_flags " ${test_name} "
227
227
psm::tools::run_verbose python -m " tests.${test_name} " " ${PSM_TEST_FLAGS[@]} "
228
228
}
229
229
@@ -317,7 +317,7 @@ psm::run::test() {
317
317
# Test driver usage: https://github.com/grpc/psm-interop#basic-usage
318
318
local test_suite=" ${1:? ${FUNCNAME[0]} missing the test suite argument} "
319
319
local test_name=" ${2:? ${FUNCNAME[0]} missing the test name argument} "
320
- local out_dir=" ${TEST_XML_OUTPUT_DIR} /${test_name} "
320
+ local out_dir=" ${TEST_XML_OUTPUT_DIR:-/ tmp / psm } /${test_name} "
321
321
local test_log=" ${out_dir} /sponge_log.log"
322
322
mkdir -p " ${out_dir} "
323
323
@@ -350,6 +350,33 @@ psm::run::test() {
350
350
" psm::${test_suite} ::run_test" " ${test_name} " | & tee -a " ${test_log} "
351
351
}
352
352
353
+ # ######################################
354
+ # Appends extra flags (if any) to the end of PSM_TEST_FLAGS, prints the flag list.
355
+ # Globals:
356
+ # PSM_TEST_FLAGS: The array with flags for the test
357
+ # PSM_EXTRA_FLAGS: Space-separated string with extra flags to append
358
+ # Arguments:
359
+ # Test case name
360
+ # Outputs:
361
+ # Prints the list of test flags to the stdout
362
+ # ######################################
363
+ psm::run::finalize_test_flags () {
364
+ local test_name=" ${1:? ${FUNCNAME[0]} missing the test name argument} "
365
+
366
+ # Append extra flags
367
+ # TODO(sergiitk): replace BAZEL_FLAGS with PSM_EXTRA_FLAGS when allowed_env_vars configured
368
+ if [[ -n " ${BAZEL_FLAGS} " ]]; then
369
+ declare -a extra_flags
370
+ IFS=' ' read -r -a extra_flags <<< " ${BAZEL_FLAGS}"
371
+ PSM_TEST_FLAGS+=(" ${extra_flags[@]} " )
372
+ fi
373
+
374
+ psm::tools::log " Test driver flags for ${test_name} :"
375
+ printf -- " %s\n" " ${PSM_TEST_FLAGS[@]} "
376
+ echo
377
+ }
378
+
379
+
353
380
# --- Common test setup logic -----------
354
381
355
382
psm::setup::generic_test_suite () {
@@ -362,8 +389,19 @@ psm::setup::generic_test_suite() {
362
389
363
390
psm::setup::get_tests () {
364
391
local test_suite=" ${1:? ${FUNCNAME[0]} missing the test suite argument} "
365
- # TODO(sergiitk): allow to override TESTS from an env var
366
- " psm::${test_suite} ::get_tests"
392
+
393
+ # TODO(sergiitk): replace BAZEL_TESTS with PSM_TESTS when allowed_env_vars configured
394
+ if [[ -n " ${BAZEL_TESTS} " ]]; then
395
+ # Test list overridden in env var.
396
+ IFS=' ' read -r -a TESTS <<< " ${BAZEL_TESTS}"
397
+ if (( ${# TESTS[@]} == 0 )) ; then
398
+ psm::tools::log " Error: test list overridden, but no tests specified"
399
+ exit 1
400
+ fi
401
+ else
402
+ " psm::${test_suite} ::get_tests"
403
+ fi
404
+
367
405
psm::tools::log " Tests in ${test_suite} test suite:"
368
406
printf -- " - %s\n" " ${TESTS[@]} "
369
407
echo
@@ -560,13 +598,6 @@ psm::tools::log() {
560
598
echo " $@ "
561
599
}
562
600
563
- psm::tools::print_test_flags () {
564
- local test_name=" ${1:? ${FUNCNAME[0]} missing the test name argument} "
565
- psm::tools::log " Test driver flags for ${test_name} :"
566
- printf -- " %s\n" " ${PSM_TEST_FLAGS[@]} "
567
- echo
568
- }
569
-
570
601
# --- "Unsorted" methods --------------
571
602
# TODO(sergiitk): all methods should be using "psm::" package name,
572
603
# see https://google.github.io/styleguide/shellguide.html#function-names
0 commit comments