Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pFpWT-0005x7-O2 for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Jan 2023 04:49:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pFpWS-00008C-LN for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Jan 2023 04:49:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pFpWS-000083-Aa for pgsql-hackers@lists.postgresql.org; Thu, 12 Jan 2023 04:49:04 +0000 Received: from mail-qt1-x836.google.com ([2607:f8b0:4864:20::836]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pFpWP-0007Jx-Og for pgsql-hackers@lists.postgresql.org; Thu, 12 Jan 2023 04:49:03 +0000 Received: by mail-qt1-x836.google.com with SMTP id a25so8503990qto.10 for ; Wed, 11 Jan 2023 20:49:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=kS22EPEME3YqYsf98DO/goJnf8OiuPRuPwmAr19sBlA=; b=sIfohmlrKV0CoGbxTUmWoiSDwHs/wxvBiwmSohlREp+Lpc1kcCpLv6B/4OSMdiBNfc M9pBl470YLT1mBH2Q78x1rHFg32kyBoi9pyuw++3+t9gkzMxHJUsXjn3KgzuC5A0ufiH KiucR2c2xPFP+1+i8oAjHyE/CuuSZ+n036FZf6c3GHWcVY+TE+pIKtqG3IervxF1KAR/ MIDL62IqVYy/3O0Tjjio6yq0jpKm2Rq4xY+S+WddNslX5A5Da72HjA6yMhDYAzWjwBmY UC+uLv42+ai+sb8E/BDDNetVdbcWnesAXXaaPXp6aI2s36ofmwgK79nJFeV6ASSuDUE2 KP2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kS22EPEME3YqYsf98DO/goJnf8OiuPRuPwmAr19sBlA=; b=z8jlwRwv/OnBUhe3SA+up5w416NGpC1EiMul3cBVj+LNxHXKP4qsdjtrpWwj0BLPX3 pmrov9xtxEyc0N2BGNy5oi0ncfkjttSG0hpS+ZlKchaYngncif6pOWHWd2yEhEi2M/Jh 729OM6bwoHf/lM+UyNRN/DPUHPHEZyyl4UKMkLS8RmbnANfXsOfWFkwZl2EaQQjL7C5u khTKrtmYEiQTOI9/jTWGVNBwmrjsvEbKsRFKDMMxs3XlmBGTB2fQVM6RaNmLHQP3vX8i FlUtldoGTjKfQWenpYNVgFF6Lq9AQKrQcTvAF+uQps29uQH1Eb+x74bq7AQczxUsWGgU BS9A== X-Gm-Message-State: AFqh2kqB0PDfqE3GHrNTtU+PpAty3qPgScalXaQulonaYJ6kaTVLaW22 n7W7OyQA67slKuerd8V6pbuTJw== X-Google-Smtp-Source: AMrXdXt/j+Wpz9jonPliFxmzcdLRtopg9+aUCHy8DtnEkG+rhkJpF8jolT4WN2jLtNDX1JciLJpWbg== X-Received: by 2002:ac8:4657:0:b0:3a9:2478:2d70 with SMTP id f23-20020ac84657000000b003a924782d70mr116702996qto.24.1673498940004; Wed, 11 Jan 2023 20:49:00 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id ay28-20020a05622a229c00b003a50d92f9b4sm8563458qtb.1.2023.01.11.20.48.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jan 2023 20:48:59 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 46B26800C8A; Wed, 11 Jan 2023 22:48:58 -0600 (CST) Date: Wed, 11 Jan 2023 22:48:58 -0600 From: Justin Pryzby To: Thomas Munro Cc: vignesh C , pgsql-hackers@lists.postgresql.org, Andrew Dunstan , Tom Lane , Andres Freund Subject: Re: Cygwin cleanup Message-ID: <20230112044858.GA17308@telsasoft.com> References: <20220804033828.GK19644@telsasoft.com> <20221021034040.GT16921@telsasoft.com> <20221109010437.GK3775@telsasoft.com> <20230103142537.GM1153@telsasoft.com> <20230112043949.GQ9837@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="VbJkn9YxBvnuCH5J" Content-Disposition: inline In-Reply-To: <20230112043949.GQ9837@telsasoft.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jan 11, 2023 at 10:39:49PM -0600, Justin Pryzby wrote: > Here's my latest copy of the patch. > + # due to resource constraints we don't run this task by default for now > + trigger_type: manual Now, with trigger_type commented, so Thomas doesn't have to click "trigger" for me. --VbJkn9YxBvnuCH5J Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-WIP-CI-support-for-Cygwin.patch" From 16d2553e1e1d95aea1c215d7e909c7ea57fe160e Mon Sep 17 00:00:00 2001 From: Thomas Munro Date: Mon, 25 Jul 2022 23:05:10 +1200 Subject: [PATCH] WIP CI support for Cygwin. See also: d8e78714-dc77-4a64-783f-e863ba4d951f@2ndquadrant.com https://cirrus-ci.com/task/5145086722834432 XXX This should use a canned Docker image with all the right packages installed? But if the larger image is slower to start, then maybe not... XXX trigger_type: manual ci-os-only: cygwin --- .cirrus.yml | 83 +++++++++++++++++++++ configure | 2 +- configure.ac | 2 +- src/backend/replication/logical/snapbuild.c | 4 +- src/test/perl/PostgreSQL/Test/Cluster.pm | 4 +- src/test/perl/PostgreSQL/Test/Utils.pm | 12 ++- src/test/recovery/t/020_archive_status.pl | 2 +- src/tools/ci/cores_backtrace.sh | 19 ++++- 8 files changed, 118 insertions(+), 10 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index d13726ed893..f704da2ff14 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -737,6 +737,89 @@ task: type: text/plain +task: + name: Windows - Cygwin + + # due to resource constraints we don't run this task by default for now + #XXX trigger_type: manual + # worth using only_if despite being manual, otherwise this task will show up + # when e.g. ci-os-only: linux is used. + only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*cygwin.*' + # otherwise it'll be sorted before other tasks + depends_on: SanityCheck + + #XXX only_if: $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*cygwin.*' + #timeout_in: 120m + + env: + CPUS: 4 + BUILD_JOBS: $CPUS + TEST_JOBS: $CPUS + CCACHE_DIR: /tmp/ccache + CCACHE_LOGFILE: ccache.log + # --disable-dynamicbase + # --with-gssapi + CONFIGURE_CACHE: /tmp/ccache/configure.cache + PG_TEST_USE_UNIX_SOCKETS: 1 + EXTRA_REGRESS_OPTS: --max-connections=1 + PG_TEST_EXTRA: ldap ssl # disable kerberos + CC: ccache gcc + CFLAGS: -Og -ggdb + BASH: C:\tools\cygwin\bin\bash.exe --login + + #windows_container: + #image: cirrusci/windowsservercore:2019-2022.06.23 + #os_version: 2019 + compute_engine_instance: + image_project: $IMAGE_PROJECT + image: family/pg-ci-windows-ci-vs-2019 + platform: windows + cpu: $CPUS + memory: 4G + + setup_additional_packages_script: | + choco install -y --no-progress cygwin + C:\tools\cygwin\cygwinsetup.exe -q -P cygrunsrv,make,gcc-core,ccache,binutils,libtool,pkg-config,flex,bison,zlib-devel,libxml2-devel,libxslt-devel,libssl-devel,openldap-devel,libreadline-devel,perl,meson,ninja,perl-IPC-Run + REM libkrb5-devel,krb5-server + %BASH% -c "cygserver-config -y" + %BASH% -c "echo 'kern.ipc.semmni 1024' >> /etc/cygserver.conf" + %BASH% -c "echo 'kern.ipc.semmns 1024' >> /etc/cygserver.conf" + %BASH% -c "net start cygserver" + + sysinfo_script: | + chcp + systeminfo + powershell -Command get-psdrive -psprovider filesystem + set + %BASH% -c "id; uname -a; ulimit -a -H; ulimit -a -S; export" + + ccache_cache: + folder: C:\tools\cygwin\tmp\ccache + fingerprint_key: ccache/cygwin + reupload_on_changes: true + + configure_script: | + %BASH% -c "cd '%cd%' && meson setup --buildtype=debug -Dcassert=true -Dssl=openssl -Duuid=e2fs -DPG_TEST_EXTRA='$PG_TEST_EXTRA' build" + + build_script: | + %BASH% -c "cd '%cd%' && ninja -C build -j${BUILD_JOBS}" + %BASH% -c "ccache --show-stats" + + always: + upload_caches: ccache + + #%BASH% -c "cd '%cd%' && echo 'data_sync_retry = on' >> src/tools/ci/pg_ci_base.conf" + #%BASH% -c "cd '%cd%' && echo 'wal_sync_method = fdatasync' >> src/tools/ci/pg_ci_base.conf" + # --repeat 9 + test_world_script: | + %BASH% -c "cd '%cd%' && meson test $MTEST_ARGS --num-processes ${TEST_JOBS}" + + on_failure: + <<: *on_failure_meson + cores_script: | + %BASH% -c "cd '%cd%' && src/tools/ci/cores_backtrace.sh cygwin ." + + task: name: CompilerWarnings # task that did not run, count as a success, so we need to recheck Linux' diff --git a/configure b/configure index 5d07fd0bb91..72d56f00534 100755 --- a/configure +++ b/configure @@ -16477,7 +16477,7 @@ fi # mingw has adopted a GNU-centric interpretation of optind/optreset, # so always use our version on Windows. -if test "$PORTNAME" = "win32"; then +if test "$PORTNAME" = "win32" -o "$PORTNAME" = "cygwin"; then case " $LIBOBJS " in *" getopt.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS getopt.$ac_objext" diff --git a/configure.ac b/configure.ac index e9b74ced6ca..e0a9c332060 100644 --- a/configure.ac +++ b/configure.ac @@ -1899,7 +1899,7 @@ fi # mingw has adopted a GNU-centric interpretation of optind/optreset, # so always use our version on Windows. -if test "$PORTNAME" = "win32"; then +if test "$PORTNAME" = "win32" -o "$PORTNAME" = "cygwin"; then AC_LIBOBJ(getopt) AC_LIBOBJ(getopt_long) fi diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index 829c5681120..f0929600fcc 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -1812,7 +1812,9 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn) } /* make sure we persist */ - fsync_fname(path, false); + if (fsync_fname_ext(path, false, false, ERROR)) + elog(ERROR, "failed to fsync"); + fsync_fname("pg_logical/snapshots", true); /* diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm index 04921ca3a3d..31ac1d020a4 100644 --- a/src/test/perl/PostgreSQL/Test/Cluster.pm +++ b/src/test/perl/PostgreSQL/Test/Cluster.pm @@ -1097,7 +1097,7 @@ sub enable_restoring # the path contains spaces. $path =~ s{\\}{\\\\}g if ($PostgreSQL::Test::Utils::windows_os); my $copy_command = - $PostgreSQL::Test::Utils::windows_os + $PostgreSQL::Test::Utils::windows_os && !$PostgreSQL::Test::Utils::is_cygwin ? qq{copy "$path\\\\%f" "%p"} : qq{cp "$path/%f" "%p"}; @@ -1167,7 +1167,7 @@ sub enable_archiving # the path contains spaces. $path =~ s{\\}{\\\\}g if ($PostgreSQL::Test::Utils::windows_os); my $copy_command = - $PostgreSQL::Test::Utils::windows_os + $PostgreSQL::Test::Utils::windows_os && !$PostgreSQL::Test::Utils::is_cygwin ? qq{copy "%p" "$path\\\\%f"} : qq{cp "%p" "$path/%f"}; diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm index 878e12b15ed..0c3f4dc35a0 100644 --- a/src/test/perl/PostgreSQL/Test/Utils.pm +++ b/src/test/perl/PostgreSQL/Test/Utils.pm @@ -88,10 +88,11 @@ our @EXPORT = qw( $windows_os $is_msys2 + $is_cygwin $use_unix_sockets ); -our ($windows_os, $is_msys2, $use_unix_sockets, $timeout_default, +our ($windows_os, $is_msys2, $is_cygwin, $use_unix_sockets, $timeout_default, $tmp_check, $log_path, $test_logfile); BEGIN @@ -140,13 +141,18 @@ BEGIN $ENV{PGAPPNAME} = basename($0); # Must be set early - $windows_os = $Config{osname} eq 'MSWin32' || $Config{osname} eq 'msys'; + $windows_os = $Config{osname} eq 'MSWin32' || $Config{osname} eq 'msys' + || $Config{osname} eq 'cygwin'; + # Check if this environment is MSYS2. $is_msys2 = $windows_os && -x '/usr/bin/uname' && `uname -or` =~ /^[2-9].*Msys/; + # Check if this environment is Cygwin + $is_cygwin = $Config{osname} eq 'cygwin'; + if ($windows_os) { require Win32API::File; @@ -707,7 +713,7 @@ sub dir_symlink { my $oldname = shift; my $newname = shift; - if ($windows_os) + if ($windows_os && !$is_cygwin) { $oldname =~ s,/,\\,g; $newname =~ s,/,\\,g; diff --git a/src/test/recovery/t/020_archive_status.pl b/src/test/recovery/t/020_archive_status.pl index 13ada994dbb..0462d1d90c2 100644 --- a/src/test/recovery/t/020_archive_status.pl +++ b/src/test/recovery/t/020_archive_status.pl @@ -26,7 +26,7 @@ my $primary_data = $primary->data_dir; # a portable solution, use an archive command based on a command known to # work but will fail: copy with an incorrect original path. my $incorrect_command = - $PostgreSQL::Test::Utils::windows_os + $PostgreSQL::Test::Utils::windows_os && !$PostgreSQL::Test::Utils::is_cygwin ? qq{copy "%p_does_not_exist" "%f_does_not_exist"} : qq{cp "%p_does_not_exist" "%f_does_not_exist"}; $primary->safe_psql( diff --git a/src/tools/ci/cores_backtrace.sh b/src/tools/ci/cores_backtrace.sh index 28d3cecfc67..c49f9b07752 100755 --- a/src/tools/ci/cores_backtrace.sh +++ b/src/tools/ci/cores_backtrace.sh @@ -1,5 +1,7 @@ #! /bin/sh +#set -e + if [ $# -ne 2 ]; then echo "cores_backtrace.sh " exit 1 @@ -8,9 +10,22 @@ fi os=$1 directory=$2 +findargs='' case $os in freebsd|linux|macos) - ;; + ;; + + cygwin) + for stack in $(find "$directory" -type f -name "*.stackdump") ; do + binary=`basename "$stack" .stackdump` + echo;echo; + echo "dumping ${stack} for ${binary}" + awk '/^0/{print $2}' $stack |addr2line -f -i -e ./build/tmp_install/usr/local/pgsql/bin/postgres.exe + #awk '/^0/{print $2}' $stack |addr2line -f -i -e "./build/src/backend/$binary.exe" + done + exit 0 + ;; + *) echo "unsupported operating system ${os}" exit 1 @@ -48,3 +63,5 @@ for corefile in $(find "$directory" -type f) ; do gdb --batch --quiet -ex "thread apply all bt full" -ex "quit" "$binary" "$corefile" 2>/dev/null fi done + +exit 0 -- 2.25.1 --VbJkn9YxBvnuCH5J--