From 24280295d5c4c5c62242de1db1ab8e7582097899 Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Fri, 25 Nov 2022 13:57:17 -0600 Subject: [PATCH 3/6] WIP: ci/meson: allow showing only failed tests .. It's simpler and seems to make more sense to integrate this with testwrap, rather than to run it after check-world, but only if it failed, and finding a way to preserve the exit code. https://www.postgresql.org/message-id/20221114235328.lxdj3puenfhirhqm@awork3.anarazel.de > It is wasteful to upload thousdands of logfiles to show a single > failure. That would make our cirrus tasks faster - compressing and > uploading the logs takes over a minute. > > It's also a lot friendlier to show fewer than 8 pages of test folders to > search through to find the one that failed. macos linux-meson ci-os-only: freebsd --- .cirrus.tasks.yml | 14 ++++++++------ src/tools/testwrap | 6 ++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml index d8c2a396a20..3df51e6c896 100644 --- a/.cirrus.tasks.yml +++ b/.cirrus.tasks.yml @@ -21,6 +21,7 @@ env: PGCTLTIMEOUT: 120 # avoids spurious failures during parallel tests TEMP_CONFIG: ${CIRRUS_WORKING_DIR}/src/tools/ci/pg_ci_base.conf PG_TEST_EXTRA: kerberos ldap ssl libpq_encryption load_balance + PG_FAILED_TESTDIR: ${CIRRUS_WORKING_DIR}/failed.build # What files to preserve in case tests fail @@ -35,9 +36,9 @@ on_failure_ac: &on_failure_ac on_failure_meson: &on_failure_meson testrun_artifacts: paths: - - "build*/testrun/**/*.log" - - "build*/testrun/**/*.diffs" - - "build*/testrun/**/regress_log_*" + - failed.build*/**/*.log + - failed.build*/**/*.diffs + - failed.build*/**/regress_log_* type: text/plain # In theory it'd be nice to upload the junit files meson generates, so that @@ -136,6 +137,7 @@ task: CPPFLAGS: -DRELCACHE_FORCE_RELEASE -DCOPY_PARSE_PLAN_TREES -DWRITE_READ_PARSE_PLAN_TREES -DRAW_EXPRESSION_COVERAGE_TEST -DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS CFLAGS: -Og -ggdb + PG_FAILED_TESTDIR: ${CIRRUS_WORKING_DIR}/failed.build PG_TEST_PG_UPGRADE_MODE: --link <<: *freebsd_task_template @@ -194,10 +196,10 @@ task: ulimit -c unlimited meson test $MTEST_ARGS --quiet --suite setup export LD_LIBRARY_PATH="$(pwd)/build/tmp_install/usr/local/pgsql/lib/:$LD_LIBRARY_PATH" - mkdir -p build/testrun + mkdir -p build/testrun ${PG_FAILED_TESTDIR} build/tmp_install/usr/local/pgsql/bin/initdb -N build/runningcheck --no-instructions -A trust echo "include '$(pwd)/src/tools/ci/pg_ci_base.conf'" >> build/runningcheck/postgresql.conf - build/tmp_install/usr/local/pgsql/bin/pg_ctl -c -o '-c fsync=off' -D build/runningcheck -l build/testrun/runningcheck.log start + build/tmp_install/usr/local/pgsql/bin/pg_ctl -c -o '-c fsync=off' -D build/runningcheck -l ${PG_FAILED_TESTDIR}/runningcheck.log start meson test $MTEST_ARGS --num-processes ${TEST_JOBS} --setup running build/tmp_install/usr/local/pgsql/bin/pg_ctl -D build/runningcheck stop EOF @@ -400,7 +402,7 @@ task: test_world_32_script: | su postgres <<-EOF ulimit -c unlimited - PYTHONCOERCECLOCALE=0 LANG=C meson test $MTEST_ARGS -C build-32 --num-processes ${TEST_JOBS} + PYTHONCOERCECLOCALE=0 LANG=C PG_FAILED_TESTDIR=`pwd`/failed.build-32 meson test $MTEST_ARGS -C build-32 --num-processes ${TEST_JOBS} EOF on_failure: diff --git a/src/tools/testwrap b/src/tools/testwrap index d01e61051cb..7e5a17dbf94 100755 --- a/src/tools/testwrap +++ b/src/tools/testwrap @@ -49,4 +49,10 @@ if sp.returncode == 0: else: print('# test failed') open(os.path.join(testdir, 'test.fail'), 'x') + faileddir = os.getenv('PG_FAILED_TESTDIR') + if faileddir: + parentdir = os.path.dirname(testdir) + newdest = os.path.join(faileddir, os.path.basename(parentdir), os.path.basename(testdir)) + shutil.copytree(testdir, newdest) + sys.exit(sp.returncode) -- 2.42.0