From a698b1f96ca162c257df4a573f3d7817e5eb8f44 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 13 Sep 2020 13:18:01 -0700 Subject: [PATCH] Reenable pgroup eval test in more robust form This re-enables the test that eval retains pgroups, from #6806. The old version was racey and failed a lot. In the new version, we use temp files to resolve the race. --- tests/checks/pipeline-pgroup.fish | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/checks/pipeline-pgroup.fish b/tests/checks/pipeline-pgroup.fish index 026db57a7..1d5adf34a 100644 --- a/tests/checks/pipeline-pgroup.fish +++ b/tests/checks/pipeline-pgroup.fish @@ -40,11 +40,17 @@ and echo "All pgroups agreed" or echo "Pgroups disagreed. Found $a0 $a1 $a2, and $b0 $b1 $b2" # CHECK: All pgroups agreed -### DISABLED - this fails a lot on Travis # Ensure that eval retains pgroups - #6806. -# Our regex will capture the first pgroup and use a positive lookahead on the second. -# $fth print_pgrp | tr \n ' ' 1>&2 | eval '$fth print_pgrp' 1>&2 -## CHECKERR: {{(\d+) (?=\1)\d+}} +set -l tmpfile1 (mktemp) +set -l tmpfile2 (mktemp) +$fth print_pgrp > $tmpfile1 | eval '$fth print_pgrp > $tmpfile2' +read -l pgrp1 < $tmpfile1 +read -l pgrp2 < $tmpfile2 +[ "$pgrp1" -eq "$pgrp2" ] +and echo "eval pgroups agreed" +or echo "eval pgroups disagreed, meaning eval does not retain pgroups: $pgrp1 $pgrp2" +# CHECK: eval pgroups agreed +rm $tmpfile1 $tmpfile2 # Ensure that if a background job launches another background job, that they have different pgroups. # The pipeline here will arrange for the two pgroups to be printed on the same line, like: