File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed
Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -292,6 +292,23 @@ test_on_rank() {
292292 flux exec --rank=${ranks} " $@ "
293293}
294294
295+ # Note: Some versions of bash may cause the `flux` libtool wrapper script
296+ # to reset the COLUMNS shell variable even if it is explicitly set for
297+ # for testing purposes. This causes tests that check for output truncation
298+ # based on COLUMNS to erroneously fail. (Note: this only seems to be the
299+ # case when tests are run with --debug --verbose for unknown reasons.
300+ #
301+ # Add a script for tests that use COLUMNS to check if the variable will
302+ # be preserved across an invovation of flux(1) so they may set a prereq
303+ # and skip tests that might erroneous fail if COLUMNS is not preserved.
304+ #
305+ test_columns_variable_preserved () {
306+ local cols=$( COLUMNS=12 \
307+ flux python -c \
308+ " import shutil; print(shutil.get_terminal_size().columns)" )
309+ test " $cols " = " 12"
310+ }
311+
295312# Export a shorter name for this test
296313TEST_NAME=$SHARNESS_TEST_NAME
297314export TEST_NAME
Original file line number Diff line number Diff line change @@ -681,7 +681,8 @@ test_expect_success 'kvs: ls -w40 adjusts output width to 40' '
681681 EOF
682682 test_cmp expected output
683683'
684- test_expect_success ' kvs: ls with COLUMNS=20 adjusts output width to 20' '
684+ test_columns_variable_preserved && test_set_prereq USE_COLUMNS
685+ test_expect_success USE_COLUMNS ' kvs: ls with COLUMNS=20 adjusts output width to 20' '
685686 flux kvs unlink -Rf $DIR &&
686687 ${FLUX_BUILD_DIR}/t/kvs/dtree -p$DIR -h1 -w50 &&
687688 COLUMNS=20 flux kvs ls $DIR | wc -wl >output &&
Original file line number Diff line number Diff line change @@ -149,7 +149,8 @@ test_expect_success 'flux-pstree -a works' '
149149 EOF
150150 test_cmp ${name}.expected ${name}.output
151151'
152- test_expect_success ' flux-pstree truncates at COLUMNS' '
152+ test_columns_variable_preserved && test_set_prereq USE_COLUMNS
153+ test_expect_success USE_COLUMNS ' flux-pstree truncates at COLUMNS' '
153154 name="truncated" &&
154155 COLUMNS=16 flux pstree -a > ${name}.output &&
155156 test_debug "cat ${name}.output" &&
You can’t perform that action at this time.
0 commit comments