From bcdcfdc27273ee8b79c40f82dbb2d96e2e0f0641 Mon Sep 17 00:00:00 2001
From: lijunlong <lijunlong@openresty.com>
Date: Thu, 23 Nov 2023 21:35:25 +0800
Subject: [PATCH] tests: update nginx to 1.25.3.

---
 .travis.yml   | 31 ++++++++++++++++++----------
 util/build.sh | 57 ++++++++++++++-------------------------------------
 2 files changed, 35 insertions(+), 53 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 600cf7d..f04a951 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,9 @@
 sudo: required
-dist: bionic
+dist: focal
+
+branches:
+  only:
+    - "master"
 
 os: linux
 
@@ -22,10 +26,14 @@ env:
     - LUA_CMODULE_DIR=/lib
     - JOBS=3
     - NGX_BUILD_JOBS=$JOBS
+    - LIBDRIZZLE_PREFIX=/opt/drizzle
+    - LIBDRIZZLE_INC=$LIBDRIZZLE_PREFIX/include/libdrizzle-1.0
+    - LIBDRIZZLE_LIB=$LIBDRIZZLE_PREFIX/lib
   matrix:
-    - NGINX_VERSION=1.17.8
-    - NGINX_VERSION=1.19.9
-    - NGINX_VERSION=1.23.0
+    - NGINX_VERSION=1.25.3
+
+addons:
+  postgresql: "13"
 
 services:
  - memcache
@@ -39,10 +47,11 @@ before_install:
 install:
   - echo $HOME
   - if [ ! -d download-cache ]; then mkdir download-cache; fi
-  - if [ ! -f download-cache/ngx_http_redis-0.3.7.tar.gz ]; then wget -O download-cache/ngx_http_redis-0.3.7.tar.gz http://people.freebsd.org/~osa/ngx_http_redis-0.3.7.tar.gz; fi
-  - if [ ! -f download-cache/drizzle7-2011.07.21.tar.gz ]; then wget -O download-cache/drizzle7-2011.07.21.tar.gz http://openresty.org/download/drizzle7-2011.07.21.tar.gz; fi
-  - mkdir -p ~/work/nginx && cp download-cache/ngx_http_redis-0.3.7.tar.gz ~/work/nginx/
-  - git clone https://github.com/openresty/nginx-devel-utils.git
+  - rm -fr download-cache/drizzle7-2011.07.21.tar.gz
+  - if [ ! -f download-cache/drizzle7-2011.07.21.tar.gz ]; then wget -P download-cache https://github.com/openresty/openresty-deps-prebuild/releases/download/v20230902/drizzle7-2011.07.21.tar.gz; fi
+  - mkdir -p ~/work/nginx
+  - git clone https://github.com/openresty/ngx_http_redis ~/work/nginx/ngx_http_redis
+  - git clone https://github.com/openresty/openresty-devel-utils.git
   - git clone https://github.com/openresty/openresty.git ../openresty
   - git clone https://github.com/openresty/no-pool-nginx.git ../no-pool-nginx
   - git clone https://github.com/simpl/ngx_devel_kit.git ../ndk-nginx-module
@@ -64,14 +73,14 @@ install:
   - git clone https://github.com/openresty/openresty.git ../ngx_openresty
 
 before_script:
-  - mysql -uroot -e 'create database ngx_test; grant all on ngx_test.* to "ngx_test"@"%" identified by "ngx_test"; flush privileges;'
+  - mysql -uroot -e "create database ngx_test; CREATE USER 'ngx_test'@'%' IDENTIFIED WITH mysql_native_password BY 'ngx_test'; grant all on ngx_test.* to 'ngx_test'@'%'; flush privileges;"
   - psql -c "create database ngx_test;" -U postgres
   - psql -c "create user ngx_test with password 'ngx_test';" -U postgres
   - psql -c "grant all privileges on database ngx_test to ngx_test;" -U postgres
 
 script:
   - tar xzf download-cache/drizzle7-2011.07.21.tar.gz && cd drizzle7-2011.07.21
-  - ./configure --prefix=/usr --without-server > build.log 2>&1 || (cat build.log && exit 1)
+  - ./configure --prefix=$LIBDRIZZLE_PREFIX --without-server > build.log 2>&1 || (cat build.log && exit 1)
   - sudo PATH=$PATH make libdrizzle-1.0 install-libdrizzle-1.0 > build.log 2>&1 || (cat build.log && exit 1)
   - cd ..
   - cd luajit2
@@ -79,7 +88,7 @@ script:
   - sudo make install PREFIX=$LUAJIT_PREFIX > build.log 2>&1 || (cat build.log && exit 1)
   - cd ..
   - cd test-nginx && sudo cpanm . && cd ..
-  - export PATH=$PWD/work/nginx/sbin:$PWD/nginx-devel-utils:$PATH
+  - export PATH=$PWD/work/nginx/sbin:$PWD/openresty-devel-utils:$PATH
   - export NGX_BUILD_CC=$CC
   - sh util/build.sh $NGINX_VERSION > build.log 2>&1 || (cat build.log && exit 1)
   - nginx -V
diff --git a/util/build.sh b/util/build.sh
index f28bac0..928d932 100755
--- a/util/build.sh
+++ b/util/build.sh
@@ -7,49 +7,22 @@ version=$1
 home=~
 force=$2
 
-ngx_redis_version=0.3.7
-cd $home/work/nginx/ || exit 1
-ngx_redis_path=$home/work/nginx/ngx_http_redis-$ngx_redis_version
-rm -rf $ngx_redis_path || exit 1
-tar -xzvf ngx_http_redis-$ngx_redis_version.tar.gz || exit 1
+ngx_redis_path=$home/work/nginx/ngx_http_redis
 
-cd $ngx_redis_path || exit 1
-
-patch_file=$root/../openresty/patches/ngx_http_redis-$ngx_redis_version-variables_in_redis_pass.patch
-if [ ! -f $patch_file ]; then
-    echo "$patch_file: No such file" > /dev/stderr
-    exit 1
-fi
-# we ignore any errors here since the target directory might have already been patched.
-patch -p1 < $patch_file || exit 1
-
-cd $ngx_redis_path || exit 1
-
-patch_file=$root/../openresty/patches/ngx_http_redis-$ngx_redis_version-default_port_fix.patch
-if [ ! -f $patch_file ]; then
-    echo "$patch_file: No such file" > /dev/stderr
-    exit 1
-fi
-# we ignore any errors here since the target directory might have already been patched.
-patch -p1 < $patch_file || exit 1
-
-cd $root || exit 1
-
-            #--without-http_memcached_module \
 ngx-build $force $version \
-            --with-cc-opt="-O0" \
-            --with-ld-opt="-Wl,-rpath,/opt/postgres/lib:/opt/drizzle/lib:/usr/local/lib:/home/lz/lib" \
-            --without-mail_pop3_module \
-            --without-mail_imap_module \
-            --without-mail_smtp_module \
-            --without-http_upstream_ip_hash_module \
-            --without-http_empty_gif_module \
-            --without-http_referer_module \
-            --without-http_autoindex_module \
-            --without-http_auth_basic_module \
-            --without-http_userid_module \
-            --add-module=$root/../ndk-nginx-module \
-            --add-module=$root/../set-misc-nginx-module \
+          --with-cc-opt="-O0" \
+          --with-ld-opt="-Wl,-rpath,/opt/postgres/lib:/opt/drizzle/lib:/usr/local/lib:/home/lz/lib" \
+          --without-mail_pop3_module \
+          --without-mail_imap_module \
+          --without-mail_smtp_module \
+          --without-http_upstream_ip_hash_module \
+          --without-http_empty_gif_module \
+          --without-http_referer_module \
+          --without-http_autoindex_module \
+          --without-http_auth_basic_module \
+          --without-http_userid_module \
+          --add-module=$root/../ndk-nginx-module \
+          --add-module=$root/../set-misc-nginx-module \
           --add-module=$ngx_redis_path \
           --add-module=$root/../xss-nginx-module \
           --add-module=$root/../redis2-nginx-module \
@@ -62,7 +35,7 @@ ngx-build $force $version \
           --add-module=$root/../drizzle-nginx-module \
           --add-module=$root/../postgres-nginx-module \
           --add-module=$root/../memc-nginx-module \
-            --add-module=$home/work/nginx/ngx_http_upstream_keepalive-0.7 \
+          --add-module=$home/work/nginx/ngx_http_upstream_keepalive-0.7 \
           --with-select_module \
           --with-poll_module \
           --without-http_ssi_module \
