Skip to content
Snippets Groups Projects
Commit fb3fb8c1 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

#8763 Improve hudson bash script

parent a7493391
No related branches found
No related tags found
No related merge requests found
......@@ -4,15 +4,8 @@
#
# Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
git clean -f -d -x
XML_RESULTS="cppunitresults.xml"
if [ $# != 1 ]; then
echo "ERROR: Exactly one argument has to be passed. Must be in {daemon, gnome}"
exit 1
fi
function build_daemon {
if [ $1 == "daemon" ]; then
# Compile the daemon
pushd daemon
make distclean
......@@ -30,14 +23,18 @@ if [ $1 == "daemon" ]; then
make check
popd
# Run the unit tests for the daemon
# pushd daemon/test
# Remove the previous XML test file
# rm -rf $XML_RESULTS
# ./run_tests.sh || exit 1
# popd
if [ $1 == 1 ]; then
# Run the unit tests for the daemon
pushd daemon/test
# Remove the previous XML test file
rm -rf $XML_RESULTS
./run_tests.sh || exit 1
popd
fi
}
function build_gnome {
elif [ $1 == "gnome" ]; then
# Compile the plugins
pushd plugins
make distclean
......@@ -55,11 +52,44 @@ elif [ $1 == "gnome" ]; then
make -j 1
make check
popd
}
else
echo "ERROR: Bad argument. Must be in {daemon, gnome}"
exit 1
if [ "$#" -eq 0 ]; then # Script needs at least one command-line argument.
echo "Usage $0 -b select which one to build: daemon or gnome
-t enable unit tests after build"
exit $E_OPTERR
fi
git clean -f -d -x
XML_RESULTS="cppunitresults.xml"
TEST=0
BUILD=
while getopts ":b: t" opt; do
case $opt in
b)
echo "-b was triggered. Parameter: $OPTARG" >&2
BUILD=$OPTARG
;;
t)
echo "-t was triggered. Tests will be run" >&2
TEST=1
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
# Call appropriate build function, with parameters if needed
build_$BUILD $TEST
# SUCCESS
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment