From 39cd68dd2990e8134aed6a9249300624ec7c6769 Mon Sep 17 00:00:00 2001 From: Richard Patel Date: Mon, 24 Aug 2020 22:14:38 +0200 Subject: [PATCH] c/reg_test: make subprocess test libc-agnostic A test in c/reg_test/run currently relies on glibc-specific print buffering behavior in a test case that checks environment vars with subprocesses. The case in question made mlr spawn a script that prints a few lines but also had mlr print lines itself at the same time. The order of lines from mlr vs subprocess are undefined, producing a slightly different outcome on Alpine Linux than on Glibc-based distributions. This commit adds the "put -q" flag to the test case effectively causing only the subprocess output to be printed (which is the one the particular test case was interested in). Relates to https://github.com/johnkerl/miller/issues/293 --- c/reg_test/expected/out | 10 ---------- c/reg_test/run | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/c/reg_test/expected/out b/c/reg_test/expected/out index f480581ec..3551d8918 100644 --- a/c/reg_test/expected/out +++ b/c/reg_test/expected/out @@ -18661,16 +18661,6 @@ mlr --from ./reg_test/input/abixy put ENV["ZYX"]="CBA".NR; print | ENV["indir"]. [ZYX]=[CBA1] a is zee [ZYX]=[CBA1] a is hat [ZYX]=[CBA1] a is pan -a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533 -a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797 -a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776 -a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463 -a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729 -a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697 -a=eks,b=zee,i=7,x=0.6117840605678454,y=0.1878849191181694 -a=zee,b=wye,i=8,x=0.5985540091064224,y=0.976181385699006 -a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059 -a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864 ================================================================ diff --git a/c/reg_test/run b/c/reg_test/run index 0ab708bc3..faa84cc34 100755 --- a/c/reg_test/run +++ b/c/reg_test/run @@ -1308,7 +1308,7 @@ echo 'x=' | run_mlr put '$y = capitalize($x)' echo 'x=hello' | run_mlr put '$y = capitalize($z)' mention LHS value on first record should result in ZYX for process creation -export indir; run_mlr --from $indir/abixy put 'ENV["ZYX"]="CBA".NR; print | ENV["indir"]."/env-assign.sh" , "a is " . $a' +export indir; run_mlr --from $indir/abixy put -q 'ENV["ZYX"]="CBA".NR; print | ENV["indir"]."/env-assign.sh" , "a is " . $a' # ---------------------------------------------------------------- announce POSITIONAL INDEXING