1ffe3c632Sopenharmony_ci#!/bin/bash
2ffe3c632Sopenharmony_ci#
3ffe3c632Sopenharmony_ci# Build and runs tests for the protobuf project. We use this script to run
4ffe3c632Sopenharmony_ci# tests on kokoro (Ubuntu and MacOS). It can run locally as well but you
5ffe3c632Sopenharmony_ci# will need to make sure the required compilers/tools are available.
6ffe3c632Sopenharmony_ci
7ffe3c632Sopenharmony_ci# For when some other test needs the C++ main build, including protoc and
8ffe3c632Sopenharmony_ci# libprotobuf.
9ffe3c632Sopenharmony_ciLAST_RELEASED=3.9.0
10ffe3c632Sopenharmony_ci
11ffe3c632Sopenharmony_ciinternal_build_cpp() {
12ffe3c632Sopenharmony_ci  if [ -f src/protoc ]; then
13ffe3c632Sopenharmony_ci    # Already built.
14ffe3c632Sopenharmony_ci    return
15ffe3c632Sopenharmony_ci  fi
16ffe3c632Sopenharmony_ci
17ffe3c632Sopenharmony_ci  # Initialize any submodules.
18ffe3c632Sopenharmony_ci  git submodule update --init --recursive
19ffe3c632Sopenharmony_ci
20ffe3c632Sopenharmony_ci  ./autogen.sh
21ffe3c632Sopenharmony_ci  ./configure CXXFLAGS="-fPIC -std=c++11"  # -fPIC is needed for python cpp test.
22ffe3c632Sopenharmony_ci                                           # See python/setup.py for more details
23ffe3c632Sopenharmony_ci  make -j$(nproc)
24ffe3c632Sopenharmony_ci}
25ffe3c632Sopenharmony_ci
26ffe3c632Sopenharmony_cibuild_cpp() {
27ffe3c632Sopenharmony_ci  internal_build_cpp
28ffe3c632Sopenharmony_ci  make check -j$(nproc) || (cat src/test-suite.log; false)
29ffe3c632Sopenharmony_ci  cd conformance && make test_cpp && cd ..
30ffe3c632Sopenharmony_ci
31ffe3c632Sopenharmony_ci  # The benchmark code depends on cmake, so test if it is installed before
32ffe3c632Sopenharmony_ci  # trying to do the build.
33ffe3c632Sopenharmony_ci  if [[ $(type cmake 2>/dev/null) ]]; then
34ffe3c632Sopenharmony_ci    # Verify benchmarking code can build successfully.
35ffe3c632Sopenharmony_ci    cd benchmarks && make cpp-benchmark && cd ..
36ffe3c632Sopenharmony_ci  else
37ffe3c632Sopenharmony_ci    echo ""
38ffe3c632Sopenharmony_ci    echo "WARNING: Skipping validation of the bench marking code, cmake isn't installed."
39ffe3c632Sopenharmony_ci    echo ""
40ffe3c632Sopenharmony_ci  fi
41ffe3c632Sopenharmony_ci}
42ffe3c632Sopenharmony_ci
43ffe3c632Sopenharmony_cibuild_cpp_tcmalloc() {
44ffe3c632Sopenharmony_ci  internal_build_cpp
45ffe3c632Sopenharmony_ci  ./configure LIBS=-ltcmalloc && make clean && make \
46ffe3c632Sopenharmony_ci      PTHREAD_CFLAGS='-pthread -DGOOGLE_PROTOBUF_HEAP_CHECK_DRACONIAN' \
47ffe3c632Sopenharmony_ci      check
48ffe3c632Sopenharmony_ci  cd src
49ffe3c632Sopenharmony_ci  PPROF_PATH=/usr/bin/google-pprof HEAPCHECK=strict ./protobuf-test
50ffe3c632Sopenharmony_ci}
51ffe3c632Sopenharmony_ci
52ffe3c632Sopenharmony_cibuild_cpp_distcheck() {
53ffe3c632Sopenharmony_ci  grep -q -- "-Og" src/Makefile.am &&
54ffe3c632Sopenharmony_ci    echo "The -Og flag is incompatible with Clang versions older than 4.0." &&
55ffe3c632Sopenharmony_ci    exit 1
56ffe3c632Sopenharmony_ci
57ffe3c632Sopenharmony_ci  # Initialize any submodules.
58ffe3c632Sopenharmony_ci  git submodule update --init --recursive
59ffe3c632Sopenharmony_ci  ./autogen.sh
60ffe3c632Sopenharmony_ci  ./configure
61ffe3c632Sopenharmony_ci  make dist
62ffe3c632Sopenharmony_ci
63ffe3c632Sopenharmony_ci  # List all files that should be included in the distribution package.
64ffe3c632Sopenharmony_ci  git ls-files | grep "^\(java\|python\|objectivec\|csharp\|js\|ruby\|php\|cmake\|examples\|src/google/protobuf/.*\.proto\)" |\
65ffe3c632Sopenharmony_ci    grep -v ".gitignore" | grep -v "java/compatibility_tests" | grep -v "java/lite/proguard.pgcfg" |\
66ffe3c632Sopenharmony_ci    grep -v "python/compatibility_tests" | grep -v "python/docs" | grep -v "python/.repo-metadata.json" |\
67ffe3c632Sopenharmony_ci    grep -v "csharp/compatibility_tests" > dist.lst
68ffe3c632Sopenharmony_ci  # Unzip the dist tar file.
69ffe3c632Sopenharmony_ci  DIST=`ls *.tar.gz`
70ffe3c632Sopenharmony_ci  tar -xf $DIST
71ffe3c632Sopenharmony_ci  cd ${DIST//.tar.gz}
72ffe3c632Sopenharmony_ci  # Check if every file exists in the dist tar file.
73ffe3c632Sopenharmony_ci  FILES_MISSING=""
74ffe3c632Sopenharmony_ci  for FILE in $(<../dist.lst); do
75ffe3c632Sopenharmony_ci    [ -f "$FILE" ] || {
76ffe3c632Sopenharmony_ci      echo "$FILE is not found!"
77ffe3c632Sopenharmony_ci      FILES_MISSING="$FILE $FILES_MISSING"
78ffe3c632Sopenharmony_ci    }
79ffe3c632Sopenharmony_ci  done
80ffe3c632Sopenharmony_ci  cd ..
81ffe3c632Sopenharmony_ci  if [ ! -z "$FILES_MISSING" ]; then
82ffe3c632Sopenharmony_ci    echo "Missing files in EXTRA_DIST: $FILES_MISSING"
83ffe3c632Sopenharmony_ci    exit 1
84ffe3c632Sopenharmony_ci  fi
85ffe3c632Sopenharmony_ci
86ffe3c632Sopenharmony_ci  # Do the regular dist-check for C++.
87ffe3c632Sopenharmony_ci  make distcheck -j$(nproc)
88ffe3c632Sopenharmony_ci}
89ffe3c632Sopenharmony_ci
90ffe3c632Sopenharmony_cibuild_dist_install() {
91ffe3c632Sopenharmony_ci  # Initialize any submodules.
92ffe3c632Sopenharmony_ci  git submodule update --init --recursive
93ffe3c632Sopenharmony_ci  ./autogen.sh
94ffe3c632Sopenharmony_ci  ./configure
95ffe3c632Sopenharmony_ci  make dist
96ffe3c632Sopenharmony_ci
97ffe3c632Sopenharmony_ci  # Unzip the dist tar file and install it.
98ffe3c632Sopenharmony_ci  DIST=`ls *.tar.gz`
99ffe3c632Sopenharmony_ci  tar -xf $DIST
100ffe3c632Sopenharmony_ci  pushd ${DIST//.tar.gz}
101ffe3c632Sopenharmony_ci  ./configure && make check -j4 && make install
102ffe3c632Sopenharmony_ci
103ffe3c632Sopenharmony_ci  export LD_LIBRARY_PATH=/usr/local/lib
104ffe3c632Sopenharmony_ci
105ffe3c632Sopenharmony_ci  # Try to install Java
106ffe3c632Sopenharmony_ci  pushd java
107ffe3c632Sopenharmony_ci  use_java jdk7
108ffe3c632Sopenharmony_ci  $MVN install
109ffe3c632Sopenharmony_ci  popd
110ffe3c632Sopenharmony_ci
111ffe3c632Sopenharmony_ci  # Try to install Python
112ffe3c632Sopenharmony_ci  virtualenv --no-site-packages venv
113ffe3c632Sopenharmony_ci  source venv/bin/activate
114ffe3c632Sopenharmony_ci  pushd python
115ffe3c632Sopenharmony_ci  python setup.py clean build sdist
116ffe3c632Sopenharmony_ci  pip install dist/protobuf-*.tar.gz
117ffe3c632Sopenharmony_ci  popd
118ffe3c632Sopenharmony_ci  deactivate
119ffe3c632Sopenharmony_ci  rm -rf python/venv
120ffe3c632Sopenharmony_ci}
121ffe3c632Sopenharmony_ci
122ffe3c632Sopenharmony_cibuild_csharp() {
123ffe3c632Sopenharmony_ci  # Required for conformance tests and to regenerate protos.
124ffe3c632Sopenharmony_ci  internal_build_cpp
125ffe3c632Sopenharmony_ci  NUGET=/usr/local/bin/nuget.exe
126ffe3c632Sopenharmony_ci
127ffe3c632Sopenharmony_ci  # Disable some unwanted dotnet options
128ffe3c632Sopenharmony_ci  export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
129ffe3c632Sopenharmony_ci  export DOTNET_CLI_TELEMETRY_OPTOUT=true
130ffe3c632Sopenharmony_ci
131ffe3c632Sopenharmony_ci  # TODO(jtattermusch): is this still needed with "first time experience"
132ffe3c632Sopenharmony_ci  # disabled?
133ffe3c632Sopenharmony_ci  # Perform "dotnet new" once to get the setup preprocessing out of the
134ffe3c632Sopenharmony_ci  # way. That spews a lot of output (including backspaces) into logs
135ffe3c632Sopenharmony_ci  # otherwise, and can cause problems. It doesn't matter if this step
136ffe3c632Sopenharmony_ci  # is performed multiple times; it's cheap after the first time anyway.
137ffe3c632Sopenharmony_ci  # (It also doesn't matter if it's unnecessary, which it will be on some
138ffe3c632Sopenharmony_ci  # systems. It's necessary on Jenkins in order to avoid unprintable
139ffe3c632Sopenharmony_ci  # characters appearing in the JUnit output.)
140ffe3c632Sopenharmony_ci  mkdir dotnettmp
141ffe3c632Sopenharmony_ci  (cd dotnettmp; dotnet new > /dev/null)
142ffe3c632Sopenharmony_ci  rm -rf dotnettmp
143ffe3c632Sopenharmony_ci
144ffe3c632Sopenharmony_ci  # Check that the protos haven't broken C# codegen.
145ffe3c632Sopenharmony_ci  # TODO(jonskeet): Fail if regenerating creates any changes.
146ffe3c632Sopenharmony_ci  csharp/generate_protos.sh
147ffe3c632Sopenharmony_ci
148ffe3c632Sopenharmony_ci  csharp/buildall.sh
149ffe3c632Sopenharmony_ci  cd conformance && make test_csharp && cd ..
150ffe3c632Sopenharmony_ci
151ffe3c632Sopenharmony_ci  # Run csharp compatibility test between 3.0.0 and the current version.
152ffe3c632Sopenharmony_ci  csharp/compatibility_tests/v3.0.0/test.sh 3.0.0
153ffe3c632Sopenharmony_ci
154ffe3c632Sopenharmony_ci  # Run csharp compatibility test between last released and the current version.
155ffe3c632Sopenharmony_ci  csharp/compatibility_tests/v3.0.0/test.sh $LAST_RELEASED
156ffe3c632Sopenharmony_ci}
157ffe3c632Sopenharmony_ci
158ffe3c632Sopenharmony_cibuild_golang() {
159ffe3c632Sopenharmony_ci  # Go build needs `protoc`.
160ffe3c632Sopenharmony_ci  internal_build_cpp
161ffe3c632Sopenharmony_ci  # Add protoc to the path so that the examples build finds it.
162ffe3c632Sopenharmony_ci  export PATH="`pwd`/src:$PATH"
163ffe3c632Sopenharmony_ci
164ffe3c632Sopenharmony_ci  export GOPATH="$HOME/gocode"
165ffe3c632Sopenharmony_ci  mkdir -p "$GOPATH/src/github.com/protocolbuffers"
166ffe3c632Sopenharmony_ci  mkdir -p "$GOPATH/src/github.com/golang"
167ffe3c632Sopenharmony_ci  rm -f "$GOPATH/src/github.com/protocolbuffers/protobuf"
168ffe3c632Sopenharmony_ci  rm -f "$GOPATH/src/github.com/golang/protobuf"
169ffe3c632Sopenharmony_ci  ln -s "`pwd`" "$GOPATH/src/github.com/protocolbuffers/protobuf"
170ffe3c632Sopenharmony_ci  export PATH="$GOPATH/bin:$PATH"
171ffe3c632Sopenharmony_ci  (cd $GOPATH/src/github.com/golang && git clone https://github.com/golang/protobuf.git && cd protobuf && git checkout v1.3.5)
172ffe3c632Sopenharmony_ci  go install github.com/golang/protobuf/protoc-gen-go
173ffe3c632Sopenharmony_ci
174ffe3c632Sopenharmony_ci  cd examples && PROTO_PATH="-I../src -I." make gotest && cd ..
175ffe3c632Sopenharmony_ci}
176ffe3c632Sopenharmony_ci
177ffe3c632Sopenharmony_ciuse_java() {
178ffe3c632Sopenharmony_ci  version=$1
179ffe3c632Sopenharmony_ci  case "$version" in
180ffe3c632Sopenharmony_ci    jdk8)
181ffe3c632Sopenharmony_ci      export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:$PATH
182ffe3c632Sopenharmony_ci      export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
183ffe3c632Sopenharmony_ci      ;;
184ffe3c632Sopenharmony_ci    jdk7)
185ffe3c632Sopenharmony_ci      export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH
186ffe3c632Sopenharmony_ci      export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
187ffe3c632Sopenharmony_ci      ;;
188ffe3c632Sopenharmony_ci    oracle7)
189ffe3c632Sopenharmony_ci      export PATH=/usr/lib/jvm/java-7-oracle/bin:$PATH
190ffe3c632Sopenharmony_ci      export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
191ffe3c632Sopenharmony_ci      ;;
192ffe3c632Sopenharmony_ci  esac
193ffe3c632Sopenharmony_ci
194ffe3c632Sopenharmony_ci  MAVEN_LOCAL_REPOSITORY=/var/maven_local_repository
195ffe3c632Sopenharmony_ci  MVN="$MVN -e -X -Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$MAVEN_LOCAL_REPOSITORY"
196ffe3c632Sopenharmony_ci
197ffe3c632Sopenharmony_ci  which java
198ffe3c632Sopenharmony_ci  java -version
199ffe3c632Sopenharmony_ci  $MVN -version
200ffe3c632Sopenharmony_ci}
201ffe3c632Sopenharmony_ci
202ffe3c632Sopenharmony_ci# --batch-mode suppresses download progress output that spams the logs.
203ffe3c632Sopenharmony_ciMVN="mvn --batch-mode"
204ffe3c632Sopenharmony_ci
205ffe3c632Sopenharmony_cibuild_java() {
206ffe3c632Sopenharmony_ci  version=$1
207ffe3c632Sopenharmony_ci  dir=java_$version
208ffe3c632Sopenharmony_ci  # Java build needs `protoc`.
209ffe3c632Sopenharmony_ci  internal_build_cpp
210ffe3c632Sopenharmony_ci  cp -r java $dir
211ffe3c632Sopenharmony_ci  cd $dir && $MVN clean && $MVN test
212ffe3c632Sopenharmony_ci  cd ../..
213ffe3c632Sopenharmony_ci}
214ffe3c632Sopenharmony_ci
215ffe3c632Sopenharmony_ci# The conformance tests are hard-coded to work with the $ROOT/java directory.
216ffe3c632Sopenharmony_ci# So this can't run in parallel with two different sets of tests.
217ffe3c632Sopenharmony_cibuild_java_with_conformance_tests() {
218ffe3c632Sopenharmony_ci  # Java build needs `protoc`.
219ffe3c632Sopenharmony_ci  internal_build_cpp
220ffe3c632Sopenharmony_ci  # This local installation avoids the problem caused by a new version not yet in Maven Central
221ffe3c632Sopenharmony_ci  cd java/bom && $MVN install
222ffe3c632Sopenharmony_ci  cd ../..
223ffe3c632Sopenharmony_ci  cd java && $MVN test && $MVN install
224ffe3c632Sopenharmony_ci  cd util && $MVN package assembly:single
225ffe3c632Sopenharmony_ci  cd ../..
226ffe3c632Sopenharmony_ci  cd conformance && make test_java && cd ..
227ffe3c632Sopenharmony_ci}
228ffe3c632Sopenharmony_ci
229ffe3c632Sopenharmony_cibuild_java_jdk7() {
230ffe3c632Sopenharmony_ci  use_java jdk7
231ffe3c632Sopenharmony_ci  build_java_with_conformance_tests
232ffe3c632Sopenharmony_ci}
233ffe3c632Sopenharmony_cibuild_java_oracle7() {
234ffe3c632Sopenharmony_ci  use_java oracle7
235ffe3c632Sopenharmony_ci  build_java oracle7
236ffe3c632Sopenharmony_ci}
237ffe3c632Sopenharmony_cibuild_java_compatibility() {
238ffe3c632Sopenharmony_ci  use_java jdk7
239ffe3c632Sopenharmony_ci  internal_build_cpp
240ffe3c632Sopenharmony_ci  # Use the unit-tests extracted from 2.5.0 to test the compatibility between
241ffe3c632Sopenharmony_ci  # 3.0.0-beta-4 and the current version.
242ffe3c632Sopenharmony_ci  cd java/compatibility_tests/v2.5.0
243ffe3c632Sopenharmony_ci  ./test.sh 3.0.0-beta-4
244ffe3c632Sopenharmony_ci
245ffe3c632Sopenharmony_ci  # Test the last released and current version.
246ffe3c632Sopenharmony_ci  ./test.sh $LAST_RELEASED
247ffe3c632Sopenharmony_ci}
248ffe3c632Sopenharmony_cibuild_java_linkage_monitor() {
249ffe3c632Sopenharmony_ci  # Linkage Monitor checks compatibility with other Google libraries
250ffe3c632Sopenharmony_ci  # https://github.com/GoogleCloudPlatform/cloud-opensource-java/tree/master/linkage-monitor
251ffe3c632Sopenharmony_ci
252ffe3c632Sopenharmony_ci  use_java jdk8
253ffe3c632Sopenharmony_ci  internal_build_cpp
254ffe3c632Sopenharmony_ci
255ffe3c632Sopenharmony_ci  # Linkage Monitor uses $HOME/.m2 local repository
256ffe3c632Sopenharmony_ci  MVN="mvn -e -B -Dhttps.protocols=TLSv1.2"
257ffe3c632Sopenharmony_ci  cd java
258ffe3c632Sopenharmony_ci  # Installs the snapshot version locally
259ffe3c632Sopenharmony_ci  $MVN install -Dmaven.test.skip=true
260ffe3c632Sopenharmony_ci
261ffe3c632Sopenharmony_ci  # Linkage Monitor uses the snapshot versions installed in $HOME/.m2 to verify compatibility
262ffe3c632Sopenharmony_ci  JAR=linkage-monitor-latest-all-deps.jar
263ffe3c632Sopenharmony_ci  curl -v -O "https://storage.googleapis.com/cloud-opensource-java-linkage-monitor/${JAR}"
264ffe3c632Sopenharmony_ci  # Fails if there's new linkage errors compared with baseline
265ffe3c632Sopenharmony_ci  java -jar $JAR com.google.cloud:libraries-bom
266ffe3c632Sopenharmony_ci}
267ffe3c632Sopenharmony_ci
268ffe3c632Sopenharmony_cibuild_objectivec_ios() {
269ffe3c632Sopenharmony_ci  # Reused the build script that takes care of configuring and ensuring things
270ffe3c632Sopenharmony_ci  # are up to date.  The OS X test runs the objc conformance test, so skip it
271ffe3c632Sopenharmony_ci  # here.
272ffe3c632Sopenharmony_ci  objectivec/DevTools/full_mac_build.sh \
273ffe3c632Sopenharmony_ci      --core-only --skip-xcode-osx --skip-xcode-tvos --skip-objc-conformance "$@"
274ffe3c632Sopenharmony_ci}
275ffe3c632Sopenharmony_ci
276ffe3c632Sopenharmony_cibuild_objectivec_ios_debug() {
277ffe3c632Sopenharmony_ci  build_objectivec_ios --skip-xcode-release
278ffe3c632Sopenharmony_ci}
279ffe3c632Sopenharmony_ci
280ffe3c632Sopenharmony_cibuild_objectivec_ios_release() {
281ffe3c632Sopenharmony_ci  build_objectivec_ios --skip-xcode-debug
282ffe3c632Sopenharmony_ci}
283ffe3c632Sopenharmony_ci
284ffe3c632Sopenharmony_cibuild_objectivec_osx() {
285ffe3c632Sopenharmony_ci  # Reused the build script that takes care of configuring and ensuring things
286ffe3c632Sopenharmony_ci  # are up to date.
287ffe3c632Sopenharmony_ci  objectivec/DevTools/full_mac_build.sh \
288ffe3c632Sopenharmony_ci      --core-only --skip-xcode-ios --skip-xcode-tvos
289ffe3c632Sopenharmony_ci}
290ffe3c632Sopenharmony_ci
291ffe3c632Sopenharmony_cibuild_objectivec_tvos() {
292ffe3c632Sopenharmony_ci  # Reused the build script that takes care of configuring and ensuring things
293ffe3c632Sopenharmony_ci  # are up to date.  The OS X test runs the objc conformance test, so skip it
294ffe3c632Sopenharmony_ci  # here.
295ffe3c632Sopenharmony_ci  objectivec/DevTools/full_mac_build.sh \
296ffe3c632Sopenharmony_ci      --core-only --skip-xcode-ios --skip-xcode-osx --skip-objc-conformance "$@"
297ffe3c632Sopenharmony_ci}
298ffe3c632Sopenharmony_ci
299ffe3c632Sopenharmony_cibuild_objectivec_tvos_debug() {
300ffe3c632Sopenharmony_ci  build_objectivec_tvos --skip-xcode-release
301ffe3c632Sopenharmony_ci}
302ffe3c632Sopenharmony_ci
303ffe3c632Sopenharmony_cibuild_objectivec_tvos_release() {
304ffe3c632Sopenharmony_ci  build_objectivec_tvos --skip-xcode-debug
305ffe3c632Sopenharmony_ci}
306ffe3c632Sopenharmony_ci
307ffe3c632Sopenharmony_cibuild_objectivec_cocoapods_integration() {
308ffe3c632Sopenharmony_ci  objectivec/Tests/CocoaPods/run_tests.sh
309ffe3c632Sopenharmony_ci}
310ffe3c632Sopenharmony_ci
311ffe3c632Sopenharmony_cibuild_python() {
312ffe3c632Sopenharmony_ci  internal_build_cpp
313ffe3c632Sopenharmony_ci  cd python
314ffe3c632Sopenharmony_ci  if [ $(uname -s) == "Linux" ]; then
315ffe3c632Sopenharmony_ci    envlist=py\{27,33,34,35,36\}-python
316ffe3c632Sopenharmony_ci  else
317ffe3c632Sopenharmony_ci    envlist=py\{27,36\}-python
318ffe3c632Sopenharmony_ci  fi
319ffe3c632Sopenharmony_ci  tox -e $envlist
320ffe3c632Sopenharmony_ci  cd ..
321ffe3c632Sopenharmony_ci}
322ffe3c632Sopenharmony_ci
323ffe3c632Sopenharmony_cibuild_python_version() {
324ffe3c632Sopenharmony_ci  internal_build_cpp
325ffe3c632Sopenharmony_ci  cd python
326ffe3c632Sopenharmony_ci  envlist=$1
327ffe3c632Sopenharmony_ci  tox -e $envlist
328ffe3c632Sopenharmony_ci  cd ..
329ffe3c632Sopenharmony_ci}
330ffe3c632Sopenharmony_ci
331ffe3c632Sopenharmony_cibuild_python27() {
332ffe3c632Sopenharmony_ci  build_python_version py27-python
333ffe3c632Sopenharmony_ci}
334ffe3c632Sopenharmony_ci
335ffe3c632Sopenharmony_cibuild_python33() {
336ffe3c632Sopenharmony_ci  build_python_version py33-python
337ffe3c632Sopenharmony_ci}
338ffe3c632Sopenharmony_ci
339ffe3c632Sopenharmony_cibuild_python34() {
340ffe3c632Sopenharmony_ci  build_python_version py34-python
341ffe3c632Sopenharmony_ci}
342ffe3c632Sopenharmony_ci
343ffe3c632Sopenharmony_cibuild_python35() {
344ffe3c632Sopenharmony_ci  build_python_version py35-python
345ffe3c632Sopenharmony_ci}
346ffe3c632Sopenharmony_ci
347ffe3c632Sopenharmony_cibuild_python36() {
348ffe3c632Sopenharmony_ci  build_python_version py36-python
349ffe3c632Sopenharmony_ci}
350ffe3c632Sopenharmony_ci
351ffe3c632Sopenharmony_cibuild_python37() {
352ffe3c632Sopenharmony_ci  build_python_version py37-python
353ffe3c632Sopenharmony_ci}
354ffe3c632Sopenharmony_ci
355ffe3c632Sopenharmony_cibuild_python38() {
356ffe3c632Sopenharmony_ci  build_python_version py38-python
357ffe3c632Sopenharmony_ci}
358ffe3c632Sopenharmony_ci
359ffe3c632Sopenharmony_cibuild_python_cpp() {
360ffe3c632Sopenharmony_ci  internal_build_cpp
361ffe3c632Sopenharmony_ci  export LD_LIBRARY_PATH=../src/.libs # for Linux
362ffe3c632Sopenharmony_ci  export DYLD_LIBRARY_PATH=../src/.libs # for OS X
363ffe3c632Sopenharmony_ci  cd python
364ffe3c632Sopenharmony_ci  if [ $(uname -s) == "Linux" ]; then
365ffe3c632Sopenharmony_ci    envlist=py\{27,33,34,35,36\}-cpp
366ffe3c632Sopenharmony_ci  else
367ffe3c632Sopenharmony_ci    envlist=py\{27,36\}-cpp
368ffe3c632Sopenharmony_ci  fi
369ffe3c632Sopenharmony_ci  tox -e $envlist
370ffe3c632Sopenharmony_ci  cd ..
371ffe3c632Sopenharmony_ci}
372ffe3c632Sopenharmony_ci
373ffe3c632Sopenharmony_cibuild_python_cpp_version() {
374ffe3c632Sopenharmony_ci  internal_build_cpp
375ffe3c632Sopenharmony_ci  export LD_LIBRARY_PATH=../src/.libs # for Linux
376ffe3c632Sopenharmony_ci  export DYLD_LIBRARY_PATH=../src/.libs # for OS X
377ffe3c632Sopenharmony_ci  cd python
378ffe3c632Sopenharmony_ci  envlist=$1
379ffe3c632Sopenharmony_ci  tox -e $envlist
380ffe3c632Sopenharmony_ci  cd ..
381ffe3c632Sopenharmony_ci}
382ffe3c632Sopenharmony_ci
383ffe3c632Sopenharmony_cibuild_python27_cpp() {
384ffe3c632Sopenharmony_ci  build_python_cpp_version py27-cpp
385ffe3c632Sopenharmony_ci}
386ffe3c632Sopenharmony_ci
387ffe3c632Sopenharmony_cibuild_python33_cpp() {
388ffe3c632Sopenharmony_ci  build_python_cpp_version py33-cpp
389ffe3c632Sopenharmony_ci}
390ffe3c632Sopenharmony_ci
391ffe3c632Sopenharmony_cibuild_python34_cpp() {
392ffe3c632Sopenharmony_ci  build_python_cpp_version py34-cpp
393ffe3c632Sopenharmony_ci}
394ffe3c632Sopenharmony_ci
395ffe3c632Sopenharmony_cibuild_python35_cpp() {
396ffe3c632Sopenharmony_ci  build_python_cpp_version py35-cpp
397ffe3c632Sopenharmony_ci}
398ffe3c632Sopenharmony_ci
399ffe3c632Sopenharmony_cibuild_python36_cpp() {
400ffe3c632Sopenharmony_ci  build_python_cpp_version py36-cpp
401ffe3c632Sopenharmony_ci}
402ffe3c632Sopenharmony_ci
403ffe3c632Sopenharmony_cibuild_python37_cpp() {
404ffe3c632Sopenharmony_ci  build_python_cpp_version py37-cpp
405ffe3c632Sopenharmony_ci}
406ffe3c632Sopenharmony_ci
407ffe3c632Sopenharmony_cibuild_python38_cpp() {
408ffe3c632Sopenharmony_ci  build_python_cpp_version py38-cpp
409ffe3c632Sopenharmony_ci}
410ffe3c632Sopenharmony_ci
411ffe3c632Sopenharmony_cibuild_python_compatibility() {
412ffe3c632Sopenharmony_ci  internal_build_cpp
413ffe3c632Sopenharmony_ci  # Use the unit-tests extracted from 2.5.0 to test the compatibility.
414ffe3c632Sopenharmony_ci  cd python/compatibility_tests/v2.5.0
415ffe3c632Sopenharmony_ci  # Test between 2.5.0 and the current version.
416ffe3c632Sopenharmony_ci  ./test.sh 2.5.0
417ffe3c632Sopenharmony_ci  # Test between 3.0.0-beta-1 and the current version.
418ffe3c632Sopenharmony_ci  ./test.sh 3.0.0-beta-1
419ffe3c632Sopenharmony_ci
420ffe3c632Sopenharmony_ci  # Test between last released and current version.
421ffe3c632Sopenharmony_ci  ./test.sh $LAST_RELEASED
422ffe3c632Sopenharmony_ci}
423ffe3c632Sopenharmony_ci
424ffe3c632Sopenharmony_cibuild_ruby23() {
425ffe3c632Sopenharmony_ci  internal_build_cpp  # For conformance tests.
426ffe3c632Sopenharmony_ci  cd ruby && bash travis-test.sh ruby-2.3.8 && cd ..
427ffe3c632Sopenharmony_ci}
428ffe3c632Sopenharmony_cibuild_ruby24() {
429ffe3c632Sopenharmony_ci  internal_build_cpp  # For conformance tests.
430ffe3c632Sopenharmony_ci  cd ruby && bash travis-test.sh ruby-2.4 && cd ..
431ffe3c632Sopenharmony_ci}
432ffe3c632Sopenharmony_cibuild_ruby25() {
433ffe3c632Sopenharmony_ci  internal_build_cpp  # For conformance tests.
434ffe3c632Sopenharmony_ci  cd ruby && bash travis-test.sh ruby-2.5.1 && cd ..
435ffe3c632Sopenharmony_ci}
436ffe3c632Sopenharmony_cibuild_ruby26() {
437ffe3c632Sopenharmony_ci  internal_build_cpp  # For conformance tests.
438ffe3c632Sopenharmony_ci  cd ruby && bash travis-test.sh ruby-2.6.0 && cd ..
439ffe3c632Sopenharmony_ci}
440ffe3c632Sopenharmony_cibuild_ruby27() {
441ffe3c632Sopenharmony_ci  internal_build_cpp  # For conformance tests.
442ffe3c632Sopenharmony_ci  cd ruby && bash travis-test.sh ruby-2.7.0 && cd ..
443ffe3c632Sopenharmony_ci}
444ffe3c632Sopenharmony_ci
445ffe3c632Sopenharmony_cibuild_javascript() {
446ffe3c632Sopenharmony_ci  internal_build_cpp
447ffe3c632Sopenharmony_ci  NODE_VERSION=node-v12.16.3-darwin-x64
448ffe3c632Sopenharmony_ci  NODE_TGZ="$NODE_VERSION.tar.gz"
449ffe3c632Sopenharmony_ci  pushd /tmp
450ffe3c632Sopenharmony_ci  curl -OL https://nodejs.org/dist/v12.16.3/$NODE_TGZ
451ffe3c632Sopenharmony_ci  tar zxvf $NODE_TGZ
452ffe3c632Sopenharmony_ci  export PATH=$PATH:`pwd`/$NODE_VERSION/bin
453ffe3c632Sopenharmony_ci  popd
454ffe3c632Sopenharmony_ci  cd js && npm install && npm test && cd ..
455ffe3c632Sopenharmony_ci  cd conformance && make test_nodejs && cd ..
456ffe3c632Sopenharmony_ci}
457ffe3c632Sopenharmony_ci
458ffe3c632Sopenharmony_ciuse_php() {
459ffe3c632Sopenharmony_ci  VERSION=$1
460ffe3c632Sopenharmony_ci  export PATH=/usr/local/php-${VERSION}/bin:$PATH
461ffe3c632Sopenharmony_ci  internal_build_cpp
462ffe3c632Sopenharmony_ci}
463ffe3c632Sopenharmony_ci
464ffe3c632Sopenharmony_ciuse_php_zts() {
465ffe3c632Sopenharmony_ci  VERSION=$1
466ffe3c632Sopenharmony_ci  export PATH=/usr/local/php-${VERSION}-zts/bin:$PATH
467ffe3c632Sopenharmony_ci  internal_build_cpp
468ffe3c632Sopenharmony_ci}
469ffe3c632Sopenharmony_ci
470ffe3c632Sopenharmony_cibuild_php5.5() {
471ffe3c632Sopenharmony_ci  use_php 5.5
472ffe3c632Sopenharmony_ci
473ffe3c632Sopenharmony_ci  pushd php
474ffe3c632Sopenharmony_ci  rm -rf vendor
475ffe3c632Sopenharmony_ci  composer update
476ffe3c632Sopenharmony_ci  composer test
477ffe3c632Sopenharmony_ci  popd
478ffe3c632Sopenharmony_ci  (cd conformance && make test_php)
479ffe3c632Sopenharmony_ci}
480ffe3c632Sopenharmony_ci
481ffe3c632Sopenharmony_cibuild_php5.6() {
482ffe3c632Sopenharmony_ci  use_php 5.6
483ffe3c632Sopenharmony_ci  pushd php
484ffe3c632Sopenharmony_ci  rm -rf vendor
485ffe3c632Sopenharmony_ci  composer update
486ffe3c632Sopenharmony_ci  composer test
487ffe3c632Sopenharmony_ci  popd
488ffe3c632Sopenharmony_ci  (cd conformance && make test_php)
489ffe3c632Sopenharmony_ci}
490ffe3c632Sopenharmony_ci
491ffe3c632Sopenharmony_cibuild_php5.6_mac() {
492ffe3c632Sopenharmony_ci  # Install PHP
493ffe3c632Sopenharmony_ci  curl -s https://php-osx.liip.ch/install.sh | bash -s 5.6
494ffe3c632Sopenharmony_ci  PHP_FOLDER=`find /usr/local -type d -name "php5-5.6*"`  # The folder name may change upon time
495ffe3c632Sopenharmony_ci  test ! -z "$PHP_FOLDER"
496ffe3c632Sopenharmony_ci  export PATH="$PHP_FOLDER/bin:$PATH"
497ffe3c632Sopenharmony_ci
498ffe3c632Sopenharmony_ci  internal_build_cpp
499ffe3c632Sopenharmony_ci
500ffe3c632Sopenharmony_ci  # Run pure-PHP tests only.
501ffe3c632Sopenharmony_ci  pushd php
502ffe3c632Sopenharmony_ci  rm -rf vendor
503ffe3c632Sopenharmony_ci  composer update
504ffe3c632Sopenharmony_ci  composer test
505ffe3c632Sopenharmony_ci  popd
506ffe3c632Sopenharmony_ci  (cd conformance && make test_php)
507ffe3c632Sopenharmony_ci}
508ffe3c632Sopenharmony_ci
509ffe3c632Sopenharmony_cibuild_php7.0() {
510ffe3c632Sopenharmony_ci  use_php 7.0
511ffe3c632Sopenharmony_ci  pushd php
512ffe3c632Sopenharmony_ci  rm -rf vendor
513ffe3c632Sopenharmony_ci  composer update
514ffe3c632Sopenharmony_ci  composer test
515ffe3c632Sopenharmony_ci  popd
516ffe3c632Sopenharmony_ci  (cd conformance && make test_php)
517ffe3c632Sopenharmony_ci}
518ffe3c632Sopenharmony_ci
519ffe3c632Sopenharmony_cibuild_php7.0_c() {
520ffe3c632Sopenharmony_ci  IS_64BIT=$1
521ffe3c632Sopenharmony_ci  use_php 7.0
522ffe3c632Sopenharmony_ci  php/tests/test.sh
523ffe3c632Sopenharmony_ci  pushd conformance
524ffe3c632Sopenharmony_ci  if [ "$IS_64BIT" = "true" ]
525ffe3c632Sopenharmony_ci  then
526ffe3c632Sopenharmony_ci    make test_php_c
527ffe3c632Sopenharmony_ci  else
528ffe3c632Sopenharmony_ci    make test_php_c_32
529ffe3c632Sopenharmony_ci  fi
530ffe3c632Sopenharmony_ci  popd
531ffe3c632Sopenharmony_ci}
532ffe3c632Sopenharmony_ci
533ffe3c632Sopenharmony_cibuild_php7.0_mixed() {
534ffe3c632Sopenharmony_ci  use_php 7.0
535ffe3c632Sopenharmony_ci  pushd php
536ffe3c632Sopenharmony_ci  rm -rf vendor
537ffe3c632Sopenharmony_ci  composer update
538ffe3c632Sopenharmony_ci  tests/compile_extension.sh
539ffe3c632Sopenharmony_ci  tests/generate_protos.sh
540ffe3c632Sopenharmony_ci  php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
541ffe3c632Sopenharmony_ci  popd
542ffe3c632Sopenharmony_ci}
543ffe3c632Sopenharmony_ci
544ffe3c632Sopenharmony_cibuild_php7.0_zts_c() {
545ffe3c632Sopenharmony_ci  IS_64BIT=$1
546ffe3c632Sopenharmony_ci  use_php_zts 7.0
547ffe3c632Sopenharmony_ci  php/tests/test.sh
548ffe3c632Sopenharmony_ci  pushd conformance
549ffe3c632Sopenharmony_ci  if [ "$IS_64BIT" = "true" ]
550ffe3c632Sopenharmony_ci  then
551ffe3c632Sopenharmony_ci    make test_php_c
552ffe3c632Sopenharmony_ci  else
553ffe3c632Sopenharmony_ci    make test_php_c_32
554ffe3c632Sopenharmony_ci  fi
555ffe3c632Sopenharmony_ci  popd
556ffe3c632Sopenharmony_ci}
557ffe3c632Sopenharmony_ci
558ffe3c632Sopenharmony_cibuild_php7.0_mac() {
559ffe3c632Sopenharmony_ci  internal_build_cpp
560ffe3c632Sopenharmony_ci  # Install PHP
561ffe3c632Sopenharmony_ci  curl -s https://php-osx.liip.ch/install.sh | bash -s 7.0
562ffe3c632Sopenharmony_ci  PHP_FOLDER=`find /usr/local -type d -name "php5-7.0*"`  # The folder name may change upon time
563ffe3c632Sopenharmony_ci  test ! -z "$PHP_FOLDER"
564ffe3c632Sopenharmony_ci  export PATH="$PHP_FOLDER/bin:$PATH"
565ffe3c632Sopenharmony_ci
566ffe3c632Sopenharmony_ci  # Install valgrind
567ffe3c632Sopenharmony_ci  echo "#! /bin/bash" > valgrind
568ffe3c632Sopenharmony_ci  chmod ug+x valgrind
569ffe3c632Sopenharmony_ci  sudo mv valgrind /usr/local/bin/valgrind
570ffe3c632Sopenharmony_ci
571ffe3c632Sopenharmony_ci  # Test
572ffe3c632Sopenharmony_ci  php/tests/test.sh
573ffe3c632Sopenharmony_ci  (cd conformance && make test_php_c)
574ffe3c632Sopenharmony_ci}
575ffe3c632Sopenharmony_ci
576ffe3c632Sopenharmony_cibuild_php7.3_mac() {
577ffe3c632Sopenharmony_ci  internal_build_cpp
578ffe3c632Sopenharmony_ci  # Install PHP
579ffe3c632Sopenharmony_ci  # We can't test PHP 7.4 with these binaries yet:
580ffe3c632Sopenharmony_ci  #   https://github.com/liip/php-osx/issues/276
581ffe3c632Sopenharmony_ci  curl -s https://php-osx.liip.ch/install.sh | bash -s 7.3
582ffe3c632Sopenharmony_ci  PHP_FOLDER=`find /usr/local -type d -name "php5-7.3*"`  # The folder name may change upon time
583ffe3c632Sopenharmony_ci  test ! -z "$PHP_FOLDER"
584ffe3c632Sopenharmony_ci  export PATH="$PHP_FOLDER/bin:$PATH"
585ffe3c632Sopenharmony_ci
586ffe3c632Sopenharmony_ci  # Install valgrind
587ffe3c632Sopenharmony_ci  echo "#! /bin/bash" > valgrind
588ffe3c632Sopenharmony_ci  chmod ug+x valgrind
589ffe3c632Sopenharmony_ci  sudo mv valgrind /usr/local/bin/valgrind
590ffe3c632Sopenharmony_ci
591ffe3c632Sopenharmony_ci  # Test
592ffe3c632Sopenharmony_ci  php/tests/test.sh
593ffe3c632Sopenharmony_ci  (cd conformance && make test_php_c)
594ffe3c632Sopenharmony_ci}
595ffe3c632Sopenharmony_ci
596ffe3c632Sopenharmony_cibuild_php_compatibility() {
597ffe3c632Sopenharmony_ci  internal_build_cpp
598ffe3c632Sopenharmony_ci  php/tests/compatibility_test.sh $LAST_RELEASED
599ffe3c632Sopenharmony_ci}
600ffe3c632Sopenharmony_ci
601ffe3c632Sopenharmony_cibuild_php_multirequest() {
602ffe3c632Sopenharmony_ci  use_php 7.4
603ffe3c632Sopenharmony_ci  php/tests/multirequest.sh
604ffe3c632Sopenharmony_ci}
605ffe3c632Sopenharmony_ci
606ffe3c632Sopenharmony_cibuild_php7.1() {
607ffe3c632Sopenharmony_ci  use_php 7.1
608ffe3c632Sopenharmony_ci  pushd php
609ffe3c632Sopenharmony_ci  rm -rf vendor
610ffe3c632Sopenharmony_ci  composer update
611ffe3c632Sopenharmony_ci  composer test
612ffe3c632Sopenharmony_ci  popd
613ffe3c632Sopenharmony_ci  (cd conformance && make test_php)
614ffe3c632Sopenharmony_ci}
615ffe3c632Sopenharmony_ci
616ffe3c632Sopenharmony_cibuild_php7.1_c() {
617ffe3c632Sopenharmony_ci  IS_64BIT=$1
618ffe3c632Sopenharmony_ci  use_php 7.1
619ffe3c632Sopenharmony_ci  php/tests/test.sh
620ffe3c632Sopenharmony_ci  pushd conformance
621ffe3c632Sopenharmony_ci  if [ "$IS_64BIT" = "true" ]
622ffe3c632Sopenharmony_ci  then
623ffe3c632Sopenharmony_ci    make test_php_c
624ffe3c632Sopenharmony_ci  else
625ffe3c632Sopenharmony_ci    make test_php_c_32
626ffe3c632Sopenharmony_ci  fi
627ffe3c632Sopenharmony_ci  popd
628ffe3c632Sopenharmony_ci}
629ffe3c632Sopenharmony_ci
630ffe3c632Sopenharmony_cibuild_php7.1_mixed() {
631ffe3c632Sopenharmony_ci  use_php 7.1
632ffe3c632Sopenharmony_ci  pushd php
633ffe3c632Sopenharmony_ci  rm -rf vendor
634ffe3c632Sopenharmony_ci  composer update
635ffe3c632Sopenharmony_ci  tests/compile_extension.sh
636ffe3c632Sopenharmony_ci  tests/generate_protos.sh
637ffe3c632Sopenharmony_ci  php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
638ffe3c632Sopenharmony_ci  popd
639ffe3c632Sopenharmony_ci}
640ffe3c632Sopenharmony_ci
641ffe3c632Sopenharmony_cibuild_php7.1_zts_c() {
642ffe3c632Sopenharmony_ci  IS_64BIT=$1
643ffe3c632Sopenharmony_ci  use_php_zts 7.1
644ffe3c632Sopenharmony_ci  php/tests/test.sh
645ffe3c632Sopenharmony_ci  pushd conformance
646ffe3c632Sopenharmony_ci  if [ "$IS_64BIT" = "true" ]
647ffe3c632Sopenharmony_ci  then
648ffe3c632Sopenharmony_ci    make test_php_c
649ffe3c632Sopenharmony_ci  else
650ffe3c632Sopenharmony_ci    make test_php_c_32
651ffe3c632Sopenharmony_ci  fi
652ffe3c632Sopenharmony_ci  popd
653ffe3c632Sopenharmony_ci}
654ffe3c632Sopenharmony_ci
655ffe3c632Sopenharmony_cibuild_php7.4() {
656ffe3c632Sopenharmony_ci  use_php 7.4
657ffe3c632Sopenharmony_ci  pushd php
658ffe3c632Sopenharmony_ci  rm -rf vendor
659ffe3c632Sopenharmony_ci  composer update
660ffe3c632Sopenharmony_ci  composer test
661ffe3c632Sopenharmony_ci  popd
662ffe3c632Sopenharmony_ci  (cd conformance && make test_php)
663ffe3c632Sopenharmony_ci}
664ffe3c632Sopenharmony_ci
665ffe3c632Sopenharmony_cibuild_php7.4_c() {
666ffe3c632Sopenharmony_ci  IS_64BIT=$1
667ffe3c632Sopenharmony_ci  use_php 7.4
668ffe3c632Sopenharmony_ci  php/tests/test.sh
669ffe3c632Sopenharmony_ci  pushd conformance
670ffe3c632Sopenharmony_ci  if [ "$IS_64BIT" = "true" ]
671ffe3c632Sopenharmony_ci  then
672ffe3c632Sopenharmony_ci    make test_php_c
673ffe3c632Sopenharmony_ci  else
674ffe3c632Sopenharmony_ci    make test_php_c_32
675ffe3c632Sopenharmony_ci  fi
676ffe3c632Sopenharmony_ci  popd
677ffe3c632Sopenharmony_ci}
678ffe3c632Sopenharmony_ci
679ffe3c632Sopenharmony_cibuild_php7.4_mixed() {
680ffe3c632Sopenharmony_ci  use_php 7.4
681ffe3c632Sopenharmony_ci  pushd php
682ffe3c632Sopenharmony_ci  rm -rf vendor
683ffe3c632Sopenharmony_ci  composer update
684ffe3c632Sopenharmony_ci  tests/compile_extension.sh
685ffe3c632Sopenharmony_ci  tests/generate_protos.sh
686ffe3c632Sopenharmony_ci  php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
687ffe3c632Sopenharmony_ci  popd
688ffe3c632Sopenharmony_ci}
689ffe3c632Sopenharmony_ci
690ffe3c632Sopenharmony_cibuild_php7.4_zts_c() {
691ffe3c632Sopenharmony_ci  IS_64BIT=$1
692ffe3c632Sopenharmony_ci  use_php_zts 7.4
693ffe3c632Sopenharmony_ci  php/tests/test.sh
694ffe3c632Sopenharmony_ci  pushd conformance
695ffe3c632Sopenharmony_ci  if [ "$IS_64BIT" = "true" ]
696ffe3c632Sopenharmony_ci  then
697ffe3c632Sopenharmony_ci    make test_php_c
698ffe3c632Sopenharmony_ci  else
699ffe3c632Sopenharmony_ci    make test_php_c_32
700ffe3c632Sopenharmony_ci  fi
701ffe3c632Sopenharmony_ci  popd
702ffe3c632Sopenharmony_ci}
703ffe3c632Sopenharmony_ci
704ffe3c632Sopenharmony_cibuild_php8.0() {
705ffe3c632Sopenharmony_ci  use_php 8.0
706ffe3c632Sopenharmony_ci  pushd php
707ffe3c632Sopenharmony_ci  rm -rf vendor
708ffe3c632Sopenharmony_ci  composer update
709ffe3c632Sopenharmony_ci  composer test
710ffe3c632Sopenharmony_ci  popd
711ffe3c632Sopenharmony_ci  (cd conformance && make test_php)
712ffe3c632Sopenharmony_ci}
713ffe3c632Sopenharmony_ci
714ffe3c632Sopenharmony_cibuild_php8.0_c() {
715ffe3c632Sopenharmony_ci  IS_64BIT=$1
716ffe3c632Sopenharmony_ci  use_php 8.0
717ffe3c632Sopenharmony_ci  php/tests/test.sh
718ffe3c632Sopenharmony_ci  pushd conformance
719ffe3c632Sopenharmony_ci  if [ "$IS_64BIT" = "true" ]
720ffe3c632Sopenharmony_ci  then
721ffe3c632Sopenharmony_ci    make test_php_c
722ffe3c632Sopenharmony_ci  else
723ffe3c632Sopenharmony_ci    make test_php_c_32
724ffe3c632Sopenharmony_ci  fi
725ffe3c632Sopenharmony_ci  popd
726ffe3c632Sopenharmony_ci}
727ffe3c632Sopenharmony_ci
728ffe3c632Sopenharmony_cibuild_php8.0_c_64() {
729ffe3c632Sopenharmony_ci  build_php8.0_c true
730ffe3c632Sopenharmony_ci}
731ffe3c632Sopenharmony_ci
732ffe3c632Sopenharmony_cibuild_php8.0_mixed() {
733ffe3c632Sopenharmony_ci  use_php 8.0
734ffe3c632Sopenharmony_ci  pushd php
735ffe3c632Sopenharmony_ci  rm -rf vendor
736ffe3c632Sopenharmony_ci  composer update
737ffe3c632Sopenharmony_ci  tests/compile_extension.sh
738ffe3c632Sopenharmony_ci  tests/generate_protos.sh
739ffe3c632Sopenharmony_ci  php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
740ffe3c632Sopenharmony_ci  popd
741ffe3c632Sopenharmony_ci}
742ffe3c632Sopenharmony_ci
743ffe3c632Sopenharmony_cibuild_php8.0_all() {
744ffe3c632Sopenharmony_ci  build_php8.0
745ffe3c632Sopenharmony_ci  build_php8.0_c_64
746ffe3c632Sopenharmony_ci  build_php8.0_mixed
747ffe3c632Sopenharmony_ci}
748ffe3c632Sopenharmony_ci
749ffe3c632Sopenharmony_cibuild_php_all_32() {
750ffe3c632Sopenharmony_ci  build_php5.5
751ffe3c632Sopenharmony_ci  build_php5.6
752ffe3c632Sopenharmony_ci  build_php7.0
753ffe3c632Sopenharmony_ci  build_php7.1
754ffe3c632Sopenharmony_ci  build_php7.4
755ffe3c632Sopenharmony_ci  build_php7.0_c $1
756ffe3c632Sopenharmony_ci  build_php7.1_c $1
757ffe3c632Sopenharmony_ci  build_php7.4_c $1
758ffe3c632Sopenharmony_ci  build_php7.0_mixed
759ffe3c632Sopenharmony_ci  build_php7.1_mixed
760ffe3c632Sopenharmony_ci  build_php7.4_mixed
761ffe3c632Sopenharmony_ci  build_php7.0_zts_c $1
762ffe3c632Sopenharmony_ci  build_php7.1_zts_c $1
763ffe3c632Sopenharmony_ci  build_php7.4_zts_c $1
764ffe3c632Sopenharmony_ci}
765ffe3c632Sopenharmony_ci
766ffe3c632Sopenharmony_cibuild_php_all() {
767ffe3c632Sopenharmony_ci  build_php_all_32 true
768ffe3c632Sopenharmony_ci  build_php_multirequest
769ffe3c632Sopenharmony_ci  build_php_compatibility
770ffe3c632Sopenharmony_ci}
771ffe3c632Sopenharmony_ci
772ffe3c632Sopenharmony_cibuild_benchmark() {
773ffe3c632Sopenharmony_ci  use_php 7.2
774ffe3c632Sopenharmony_ci  cd kokoro/linux/benchmark && ./run.sh
775ffe3c632Sopenharmony_ci}
776ffe3c632Sopenharmony_ci
777ffe3c632Sopenharmony_ci# -------- main --------
778ffe3c632Sopenharmony_ci
779ffe3c632Sopenharmony_ciif [ "$#" -ne 1 ]; then
780ffe3c632Sopenharmony_ci  echo "
781ffe3c632Sopenharmony_ciUsage: $0 { cpp |
782ffe3c632Sopenharmony_ci            cpp_distcheck |
783ffe3c632Sopenharmony_ci            csharp |
784ffe3c632Sopenharmony_ci            java_jdk7 |
785ffe3c632Sopenharmony_ci            java_oracle7 |
786ffe3c632Sopenharmony_ci            java_compatibility |
787ffe3c632Sopenharmony_ci            java_linkage_monitor |
788ffe3c632Sopenharmony_ci            objectivec_ios |
789ffe3c632Sopenharmony_ci            objectivec_ios_debug |
790ffe3c632Sopenharmony_ci            objectivec_ios_release |
791ffe3c632Sopenharmony_ci            objectivec_osx |
792ffe3c632Sopenharmony_ci            objectivec_tvos |
793ffe3c632Sopenharmony_ci            objectivec_tvos_debug |
794ffe3c632Sopenharmony_ci            objectivec_tvos_release |
795ffe3c632Sopenharmony_ci            objectivec_cocoapods_integration |
796ffe3c632Sopenharmony_ci            python |
797ffe3c632Sopenharmony_ci            python_cpp |
798ffe3c632Sopenharmony_ci            python_compatibility |
799ffe3c632Sopenharmony_ci            ruby23 |
800ffe3c632Sopenharmony_ci            ruby24 |
801ffe3c632Sopenharmony_ci            ruby25 |
802ffe3c632Sopenharmony_ci            ruby26 |
803ffe3c632Sopenharmony_ci            ruby27 |
804ffe3c632Sopenharmony_ci            jruby |
805ffe3c632Sopenharmony_ci            ruby_all |
806ffe3c632Sopenharmony_ci            php5.5   |
807ffe3c632Sopenharmony_ci            php5.6   |
808ffe3c632Sopenharmony_ci            php7.0   |
809ffe3c632Sopenharmony_ci            php7.0_c |
810ffe3c632Sopenharmony_ci            php_compatibility |
811ffe3c632Sopenharmony_ci            php7.1   |
812ffe3c632Sopenharmony_ci            php7.1_c |
813ffe3c632Sopenharmony_ci            php_all |
814ffe3c632Sopenharmony_ci            dist_install |
815ffe3c632Sopenharmony_ci            benchmark)
816ffe3c632Sopenharmony_ci"
817ffe3c632Sopenharmony_ci  exit 1
818ffe3c632Sopenharmony_cifi
819ffe3c632Sopenharmony_ci
820ffe3c632Sopenharmony_ciset -e  # exit immediately on error
821ffe3c632Sopenharmony_ciset -x  # display all commands
822ffe3c632Sopenharmony_cicd $(dirname $0)
823ffe3c632Sopenharmony_cieval "build_$1"
824