File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- #! /usr/bin/env bash
2- # cleanup function to ensure background cloudSQL process is terminated
1+ #! /bin/bash
2+
3+ # cloudSQL E2E and Logic Test Runner
4+ # This script builds the engine and runs both Python E2E tests and SLT logic tests.
5+
36cleanup () {
4- if [ -n " $SQL_PID " ] ; then
5- kill $SQL_PID 2> /dev/null || true
6- wait $SQL_PID 2> /dev/null || true
7+ echo " Shutting down... "
8+ if [ ! -z " $SQL_PID " ] ; then
9+ kill $SQL_PID 2> /dev/null
710 fi
811}
912
@@ -18,8 +21,21 @@ TEST_DATA_DIR="$ROOT_DIR/test_data"
1821rm -rf " $TEST_DATA_DIR " || true
1922mkdir -p " $TEST_DATA_DIR "
2023
24+ # Detect CPU count for parallel make
25+ if command -v nproc > /dev/null 2>&1 ; then
26+ CPU_COUNT=$( nproc)
27+ elif command -v sysctl > /dev/null 2>&1 ; then
28+ CPU_COUNT=$( sysctl -n hw.ncpu)
29+ elif command -v getconf > /dev/null 2>&1 ; then
30+ CPU_COUNT=$( getconf _NPROCESSORS_ONLN)
31+ else
32+ CPU_COUNT=1
33+ fi
34+
35+ echo " Detected $CPU_COUNT CPUs, building with -j$CPU_COUNT "
36+
2137cd " $BUILD_DIR " || exit 1
22- make -j$( sysctl -n hw.ncpu )
38+ make -j" $CPU_COUNT "
2339./cloudSQL -p 5438 -d " $TEST_DATA_DIR " &
2440SQL_PID=$!
2541sleep 2
You can’t perform that action at this time.
0 commit comments