[Tarantool-patches] [PATCH v2 1/2] gitlab-ci: save failed test results files

Alexander Turenko alexander.turenko at tarantool.org
Mon Sep 21 05:18:13 MSK 2020


> +  <<: *artifacts_reject_files_definition
> +
> +.pack_artifacts_reject_files_template: &pack_artifacts_reject_files_definition
> +  <<: *artifacts_reject_files_definition
> +  after_script:
> +    - >
> +      for f in `ls build/usr/src/*/tarantool-*/test/*/*.reject` ; do

Nit: 'for f in path-with-star-globbing; do' would do almost the same and
I would suggest to use the simpler form (it also does not depend on an
external tool and does not involve forking), but this way we should
handle 'no such files' case explicitly. See example here:

https://github.com/tarantool/tarantool/commit/080beba063b05b184d7befcb15a8bcf32e7424f6

 | for file in @TARANTOOL_ENABLEDDIR@/*.lua; do
 |     instance=`basename $file .lua`
 |     [ "${instance}" = "*" ] && break  # skip empty directory
 |     <...>
 | done

When the glob is not matched, it falls into the loop with the 'as is'
value (with star symbols).

We all like bourne shell for those funny pitfalls.

> +          d=`dirname $f | sed 's#^build/usr/src/.*/tarantool-.*/test/##g'` ;
> +          mkdir -p test/$d 2>/dev/null ;
> +          cp $f test/$d/. ;
> +      done ;
> +      rm -rf test/var ; mkdir -p test/var ;
> +      cp -r build/usr/src/*/tarantool-*/test/var/artifacts test/var/.

Nit: The period at the end looks unusual, but don't change anything.

The patch would be a way simpler if test-run would collect everything
that is necessary to upload within the artifacts directory.

In fact, reject files are already there:
test/var/artifacts/<worker_name>/<test_name>.result. But if you want to
organize them in an another way, I would do this on the test-run side
(somewhere within test/var/artifacts).

Related code: [1]. See, the reject file is just copied, not moved.

[1]: https://github.com/tarantool/test-run/blob/461731d71cf27faa6295bc759941f402fedc88e4/lib/test.py#L254


More information about the Tarantool-patches mailing list