This commit will cause a minorchange in workflow so I wanted to warn
everyone. Instead of:
   . config.sh
it will be 
   . <build>/config.sh

and instead of:
   . config.sh; bin/test.sh
it will be just
    ./test.sh

See below for details. If nobody yells I'll check this in in a few days:

----

NO-JIRA: Ratiaonlize config.sh and test.sh

The config.sh in the dispatch/ root dir has a couple of problems:

- redundant given the generated config.sh in a build.
- not useful if you have several builds.
- clashes with the generated config.sh in an in-tree build.

This is a small simplification that preserves the
one-button test.sh and gets rid of the redundant config.sh:

- removed dispatch/config.sh
- moved dispatch/bin/test.sh to dispatch/test.sh

One button to clean, build, install and test with no prior env. setup:

    cd dispatch; ./test.sh

By default this removes and re-builds/re-installs the build/ and
install/ subdirs, but you can specifiy alternate build and install
subdirs.

For any build directory:

    source <build>/config.sh

will set up paths so you can run executables, script or tests from that
build on the command line.

As before the generated <build>/run.py is used by cmake so it can work
withouut prior env. settings.

68f8259 NO-JIRA: Ratiaonlize config.sh and test.sh

diff --git a/bin/rebuild.sh b/bin/rebuild.sh
deleted file mode 100755
index 465c103..0000000
--- a/bin/rebuild.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-set -ev
-
-rm -rf $BUILD_DIR
-rm -rf $INSTALL_DIR
-
-mkdir $BUILD_DIR
-cd $BUILD_DIR
-
-cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DCMAKE_BUILD_TYPE=Debug "$@" $SOURCE_DIR
-make -j4
-make install
diff --git a/bin/test.sh b/bin/test.sh
deleted file mode 100755
index 44f8465..0000000
--- a/bin/test.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/env bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-test -z "$SOURCE_DIR" -a -f config.sh && source ./config.sh
-
-if [[ -z "$SOURCE_DIR" ]]; then
-    echo "The devel environment isn't ready.  Run 'source config.sh' from"
-    echo "the base of the dispatch source tree"
-    exit 1
-fi
-
-set -ev
-
-rm -rf $BUILD_DIR
-rm -rf $INSTALL_DIR
-
-mkdir $BUILD_DIR
-cd $BUILD_DIR
-
-cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DCMAKE_BUILD_TYPE=Debug $SOURCE_DIR
-make -j4
-make install
-cd tests
-# Run unit tests on the build.
-ctest -VV -E system_tests
-# Run system tests on the install.
-python $INSTALL_DIR/lib/qpid-dispatch/tests/run_system_tests.py
diff --git a/config.sh b/config.sh
deleted file mode 100644
index 7e5e97f..0000000
--- a/config.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-if [[ ! -f config.sh ]]; then
-    echo "You must source config.sh from within its own directory"
-    return
-fi
-
-export SOURCE_DIR=$(pwd)
-export BUILD_DIR=$SOURCE_DIR/${1:-build}
-export INSTALL_DIR=$SOURCE_DIR/${2:-install}
-
-PYTHON_LIB=$(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(prefix='$INSTALL_DIR')")
-
-export LD_LIBRARY_PATH=$INSTALL_DIR/lib64:$INSTALL_DIR/lib:$LD_LIBRARY_PATH
-export PYTHONPATH=$PYTHON_LIB:$PYTHONPATH
-export PATH=$INSTALL_DIR/sbin:$INSTALL_DIR/bin:$SOURCE_DIR/bin:$PATH
diff --git a/test.sh b/test.sh
new file mode 100755
index 0000000..65b0049
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+usage() {
+    echo "Usage: ./test.sh [build-dir [install-dir]]"
+    echo
+    echo "Clean, build, install and test dispatch in one step"
+    echo "Must be run from the directory containing the test.sh script."
+    echo "build-dir defaults to `$PWD/build`, install-dir to `$PWD/install`"
+    exit 1
+}
+test -f "test.sh" -a -f "CMakeLists.txt" || usage
+
+SOURCE_DIR=$PWD
+BUILD_DIR=${1:-$PWD/build}; shift
+INSTALL_DIR=${1:-$PWD/install}; shift
+
+mkdir -p $BUILD_DIR || { echo "Can't create directory $BUILD_DIR"; exit 1; }
+mkdir -p $INSTALL_DIR || { echo "Can't create directory $INSTALL_DIR"; exit 1; }
+rm -rf $BUILD_DIR/* $INSTALL_DIR/*
+
+cd $BUILD_DIR
+cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DCMAKE_BUILD_TYPE=Debug $SOURCE_DIR
+make -j4
+make install
+
+cd tests
+# Run unit tests on the build.
+ctest -VV -E system_tests
+
+# Run system tests on the installed code.
+export PATH="$INSTALL_DIR/bin:$INSTALL_DIR/sbin:$PATH"
+PYTHON_VERSION=$(python -c 'import sys; print "%s.%s"%(sys.version_info[0:2])')
+export PYTHONPATH="$INSTALL_DIR/lib/python$PYTHON_VERSION/site-packages:$PYTHONPATH"
+export LD_LIBRARY_PATH="$INSTALL_DIR/lib64:$INSTALL_DIR/lib:$LD_LIBRARY_PATH"
+
+python $INSTALL_DIR/lib/qpid-dispatch/tests/run_system_tests.py
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to