CI: Fix path confusion in OpenCL Piglit execution

When we remove the contents of the results directory, we `cd` into it.
The script expects that $PWD is /piglit, and $OLDPWD is the Mesa build
directory, however the cd into the results directory will make $OLDPWD
be $BUILDDIR/results.

This means that Piglit emits into results/results/ which looks weird,
but more importantly also fails OpenCL Piglit execution, because we
can't find our baseline result expectations.

Fix it by using an explicit variable rather than relying on history.

Fixes: 683ddf19dc ("ci: remove results directory content only with piglit runners")
Ref: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10856
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Martin Peres <martin.peres@mupuf.org>
Reviewed-by: Andres Gomez <agomez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11126>
This commit is contained in:
Daniel Stone 2021-05-31 21:01:42 +01:00 committed by Marge Bot
parent fce726451b
commit d58c76035b

View file

@ -4,17 +4,18 @@ set -e
set -o xtrace set -o xtrace
VERSION=`head -1 install/VERSION` VERSION=`head -1 install/VERSION`
ROOTDIR=`pwd`
if [ -d results ]; then if [ -d results ]; then
cd results && rm -rf ..?* .[!.]* * cd results && rm -rf ..?* .[!.]* *
fi fi
cd /piglit cd /piglit
export OCL_ICD_VENDORS=$OLDPWD/install/etc/OpenCL/vendors/ export OCL_ICD_VENDORS=$ROOTDIR/install/etc/OpenCL/vendors/
set +e set +e
unset DISPLAY unset DISPLAY
export LD_LIBRARY_PATH=$OLDPWD/install/lib export LD_LIBRARY_PATH=$ROOTDIR/install/lib
clinfo clinfo
# If the job is parallel at the gitlab job level, will take the corresponding # If the job is parallel at the gitlab job level, will take the corresponding
@ -36,7 +37,7 @@ if [ -n "$USE_CASELIST" ]; then
PIGLIT_TESTS="--test-list /tmp/case-list.txt" PIGLIT_TESTS="--test-list /tmp/case-list.txt"
fi fi
./piglit run -c -j${FDO_CI_CONCURRENT:-4} $PIGLIT_OPTIONS $PIGLIT_TESTS $PIGLIT_PROFILES $OLDPWD/results ./piglit run -c -j${FDO_CI_CONCURRENT:-4} $PIGLIT_OPTIONS $PIGLIT_TESTS $PIGLIT_PROFILES $ROOTDIR/results
retVal=$? retVal=$?
if [ $retVal -ne 0 ]; then if [ $retVal -ne 0 ]; then
echo "Found $(cat /tmp/version.txt), expected $VERSION" echo "Found $(cat /tmp/version.txt), expected $VERSION"
@ -45,7 +46,7 @@ set -e
PIGLIT_RESULTS=${PIGLIT_RESULTS:-$PIGLIT_PROFILES} PIGLIT_RESULTS=${PIGLIT_RESULTS:-$PIGLIT_PROFILES}
mkdir -p .gitlab-ci/piglit mkdir -p .gitlab-ci/piglit
./piglit summary console $OLDPWD/results \ ./piglit summary console $ROOTDIR/results \
| tee ".gitlab-ci/piglit/$PIGLIT_RESULTS.txt.orig" \ | tee ".gitlab-ci/piglit/$PIGLIT_RESULTS.txt.orig" \
| head -n -1 \ | head -n -1 \
| grep -v ": pass" \ | grep -v ": pass" \
@ -57,17 +58,17 @@ if [ -n "$USE_CASELIST" ]; then
# executed, and switch to the version with no summary # executed, and switch to the version with no summary
cat .gitlab-ci/piglit/$PIGLIT_RESULTS.txt.orig | sed '/^summary:/Q' | rev \ cat .gitlab-ci/piglit/$PIGLIT_RESULTS.txt.orig | sed '/^summary:/Q' | rev \
| cut -f2- -d: | rev | sed "s/$/:/g" > /tmp/executed.txt | cut -f2- -d: | rev | sed "s/$/:/g" > /tmp/executed.txt
grep -F -f /tmp/executed.txt $OLDPWD/install/$PIGLIT_RESULTS.txt \ grep -F -f /tmp/executed.txt $ROOTDIR/install/$PIGLIT_RESULTS.txt \
> .gitlab-ci/piglit/$PIGLIT_RESULTS.txt.baseline || true > .gitlab-ci/piglit/$PIGLIT_RESULTS.txt.baseline || true
else else
cp $OLDPWD/install/$PIGLIT_RESULTS.txt .gitlab-ci/piglit/$PIGLIT_RESULTS.txt.baseline cp $ROOTDIR/install/$PIGLIT_RESULTS.txt .gitlab-ci/piglit/$PIGLIT_RESULTS.txt.baseline
fi fi
if diff -q .gitlab-ci/piglit/$PIGLIT_RESULTS.txt{.baseline,}; then if diff -q .gitlab-ci/piglit/$PIGLIT_RESULTS.txt{.baseline,}; then
exit 0 exit 0
fi fi
./piglit summary html --exclude-details=pass $OLDPWD/results/summary $OLDPWD/results ./piglit summary html --exclude-details=pass $ROOTDIR/results/summary $ROOTDIR/results
echo Unexpected change in results: echo Unexpected change in results:
diff -u .gitlab-ci/piglit/$PIGLIT_RESULTS.txt{.baseline,} diff -u .gitlab-ci/piglit/$PIGLIT_RESULTS.txt{.baseline,}