You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2019/01/18 17:15:35 UTC

[pulsar] branch master updated: [cpp-build] support run specific cpp-test using docker build script (#3386)

This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 484efa2  [cpp-build] support run specific cpp-test using docker build script (#3386)
484efa2 is described below

commit 484efa2b7861c6d0c6d04012ed4f2b0148c2402b
Author: Rajan Dhabalia <rd...@apache.org>
AuthorDate: Fri Jan 18 09:15:29 2019 -0800

    [cpp-build] support run specific cpp-test using docker build script (#3386)
---
 pulsar-client-cpp/docker-tests.sh   | 23 +++++++++++++++++++++--
 pulsar-client-cpp/run-unit-tests.sh |  9 +++++++--
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/pulsar-client-cpp/docker-tests.sh b/pulsar-client-cpp/docker-tests.sh
index f3626c9..5336827 100755
--- a/pulsar-client-cpp/docker-tests.sh
+++ b/pulsar-client-cpp/docker-tests.sh
@@ -23,6 +23,13 @@
 # Fail script in case of errors
 set -e
 
+if [ "$1" = "--help" ]; then
+    echo "Usage:"
+    echo "--tests=\"<test-regex>\" (eg: --test=\"BasicEndToEndTest.*\")"
+    exit 0
+fi
+
+
 ROOT_DIR=$(git rev-parse --show-toplevel)
 cd $ROOT_DIR/pulsar-client-cpp
 
@@ -31,12 +38,24 @@ BUILD_IMAGE_VERSION="${BUILD_IMAGE_VERSION:-ubuntu-16.04}"
 
 IMAGE="$BUILD_IMAGE_NAME:$BUILD_IMAGE_VERSION"
 
-echo "---- Testing Pulsar C++ client using image $IMAGE"
+echo "---- Testing Pulsar C++ client using image $IMAGE (type --help for more options)"
 
 docker pull $IMAGE
 
 DOCKER_CMD="docker run -i -v $ROOT_DIR:/pulsar $IMAGE"
 
+
+for args in "$@"
+do
+    arg=$(echo $args | cut -f1 -d=)
+    val=$(echo $args | cut -f2 -d=)   
+
+    case "$arg" in
+            --tests)   tests=${val} ;;
+            *)   
+    esac    
+done
+
 # Start 2 Pulsar standalone instances (one with TLS and one without)
 # and execute the tests
-$DOCKER_CMD bash -c 'cd /pulsar/pulsar-client-cpp && ./run-unit-tests.sh'
+$DOCKER_CMD bash -c "cd /pulsar/pulsar-client-cpp && ./run-unit-tests.sh ${tests}"
diff --git a/pulsar-client-cpp/run-unit-tests.sh b/pulsar-client-cpp/run-unit-tests.sh
index e9caefa..9dd1c95 100755
--- a/pulsar-client-cpp/run-unit-tests.sh
+++ b/pulsar-client-cpp/run-unit-tests.sh
@@ -24,12 +24,17 @@ ROOT_DIR=$(git rev-parse --show-toplevel)
 cd $ROOT_DIR/pulsar-client-cpp
 
 ./pulsar-test-service-start.sh
-
 pushd tests
 
 if [ -f /gtest-parallel/gtest-parallel ]; then
     echo "---- Run unit tests in parallel"
-    /gtest-parallel/gtest-parallel ./main --workers=10
+    tests=""
+    if [ $# -eq 1 ]; then
+        tests="--gtest_filter=$1"
+        echo "Running tests: $1"
+    fi
+    /gtest-parallel/gtest-parallel ./main $tests --workers=10
+    exit 0
     RES=$?
 else
     ./main