Re: [PATCH v2 8/8] travis-ci: only print test failures if there are test results available
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Dec 16, 2017, 18:32 UTC
- Message-ID
- <CAPig+cTL5hU6R=L3M2i0kfM6_zMLvcHWvNooAr8BU3VQ=X0_Ww@mail.gmail.com>
- In-Reply-To
- <20171216125819.11263-1-szeder.dev@gmail.com>
On Sat, Dec 16, 2017 at 7:58 AM, SZEDER Gábor <szeder.dev@gmail.com> wrote:
Show 21 quoted lines
> When a build job running the test suite fails, our > 'ci/print-test-failures.sh' script scans all 't/test-results/*.exit' > files to find failed tests and prints their verbose output. However, > if a build job were to fail before it ever gets to run the test suite, > then there will be no files to match the above pattern and the shell > will take the pattern literally, resulting in errors like this in the > trace log: > > cat: t/test-results/*.exit: No such file or directory > ------------------------------------------------------------------------ > t/test-results/*.out... > ------------------------------------------------------------------------ > cat: t/test-results/*.out: No such file or directory > > Check upfront and proceed only if there are any such files present. > > Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> > --- > diff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh > @@ -8,6 +8,12 @@ > +if test t/test-results/*.exit = "t/test-results/*.exit"
Isn't the above going to cause 'test' to error out?
$ mkdir -p t/test-results
$ >t/test-results/a.exit
$ >t/test-results/b.exit
$ test t/test-results/*.exit = 't/test-results/*.exit'
-bash: test: too many argumentsI'd think you'd want to capture the result of the expansion of t/test-result/*.exit as a string and compare that instead.
> +then > + echo "Build job failed before the tests could have been run" > + exit > +fi