From 9aace45e27a1bc0bacd5922db9878d724b7bc492 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Wed, 28 Sep 2022 19:54:59 -0500
Subject: [PATCH 3/3] f!convert to meson

https://cirrus-ci.com/task/5982327657463808
https://community.chocolatey.org/packages/Cygwin#versionhistory

ci-os-only: cygwin
---
 .cirrus.yml                     | 34 +++++++++++++--------------------
 src/tools/ci/cores_backtrace.sh |  4 ++--
 2 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 02b0f3b7045..57610e669e8 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -466,24 +466,24 @@ task:
 
 task:
   name: Windows - Cygwin
-  only_if: $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*cygwin.*'
   #XXX only_if: $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*cygwin.*'
-  timeout_in: 90m
+  #XXX only_if: $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*cygwin.*'
+  #timeout_in: 90m
 
   env:
     CPUS: 4
-    BUILD_JOBS: 4
-    TEST_JOBS: 1
+    BUILD_JOBS: $CPUS
+    TEST_JOBS: $CPUS
     CCACHE_DIR: /tmp/ccache
     CCACHE_LOGFILE: ccache.log
-    CONFIGURE_FLAGS: --enable-cassert --enable-debug --with-ldap --with-ssl=openssl --with-libxml
-    # --enable-tap-tests
     # --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
 
   windows_container:
     image: cirrusci/windowsservercore:2019-2022.06.23
@@ -493,7 +493,7 @@ task:
 
   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
+    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
     REM perl-IPC-Run,
     REM libkrb5-devel,krb5-server
     C:\tools\cygwin\bin\bash.exe --login -c "cygserver-config -y"
@@ -514,28 +514,20 @@ task:
     reupload_on_changes: true
 
   configure_script:
-    # Try to configure with the cache file, and retry without if it fails, in case the flags changed.
-    - C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%' && for i in 1 2; do ./configure --cache-file=${CONFIGURE_CACHE} ${CONFIGURE_FLAGS} CC='ccache gcc' CFLAGS='-Og -ggdb' && break; rm -v ${CONFIGURE_CACHE}; done"
+    - C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%' && meson setup --buildtype=debug -Dcassert=true -Dssl=openssl -Duuid=e2fs -Dtap_tests=disabled -DPG_TEST_EXTRA='$PG_TEST_EXTRA' build"
 
   build_script:
-    #- C:\tools\cygwin\bin\bash.exe --login -c "ccache --max-size ${CCACHE_MAXSIZE}"
-    - C:\tools\cygwin\bin\bash.exe --login -c "ccache --zero-stats"
-    - C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%' && make -s -j ${BUILD_JOBS} world-bin"
+    - C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%' && ninja -C build -j${BUILD_JOBS}"
     - C:\tools\cygwin\bin\bash.exe --login -c "ccache --show-stats"
 
-  upload_caches: ccache
+  always:
+    upload_caches: ccache
 
   test_world_script:
-    #- C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%' && timeout 44m make -s -j ${TEST_JOBS} check ${CHECKFLAGS} -C src/test/subscription"
-    #- C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%' && timeout 44m make -s -j ${TEST_JOBS} check ${CHECKFLAGS} -C src/test/recovery"
-    - C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%' && timeout 44m make -s -j ${TEST_JOBS} check ${CHECKFLAGS} -C src/test/modules/test_misc"
-    - C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%' && timeout 44m make -s -j ${TEST_JOBS} check ${CHECKFLAGS} -C src/interfaces/libpq"
-    - C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%' && timeout 44m make -s -j ${TEST_JOBS} check ${CHECKFLAGS} -C src/bin/psql"
-    #- C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%' && timeout 44m make -s check ${CHECKFLAGS} -C src/bin -j 2"
-    - C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%' && timeout 77m make -s -j ${TEST_JOBS} ${CHECK} PROVE_FLAGS='-j2 --timer' ${CHECKFLAGS}"
+    - C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%' && meson test $MTEST_ARGS --num-processes ${TEST_JOBS}"
 
   on_failure:
-    <<: *on_failure_ac
+    <<: *on_failure_meson
     cores_script:
       - C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%' && src/tools/ci/cores_backtrace.sh cygwin ."
 
diff --git a/src/tools/ci/cores_backtrace.sh b/src/tools/ci/cores_backtrace.sh
index 02bd50b10fa..1f0f8795fc6 100755
--- a/src/tools/ci/cores_backtrace.sh
+++ b/src/tools/ci/cores_backtrace.sh
@@ -23,8 +23,8 @@ case $os in
             binary=`basename "$stack" .stackdump`
             echo;echo;
             echo "dumping ${stack} for ${binary}"
-            awk '/^0/{print $2}' $stack |addr2line -f -i -e ./src/backend/postgres.exe
-            #awk '/^0/{print $2}' $stack |addr2line -f -i -e "./src/backend/$binary.exe"
+            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
         ;;
-- 
2.25.1

