Skip to content

Commit

Permalink
rpm/dpkg: use local testconfig.sh
Browse files Browse the repository at this point in the history
Use local 'src/test/testconfig.sh' (if it exists)
instead of coping 'testconfig.sh.example' as a unit tests'
config file during 'make rpm' and 'make dpkg'.
  • Loading branch information
ldorau committed Jul 9, 2015
1 parent 42ab7e5 commit b6c7779
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ pkg-clean:
$(RM) -r $(DESTDIR)

rpm dpkg: pkg-clean source
utils/build-$@.sh $(SRCVERSION) $(DESTDIR)/nvml $(DESTDIR) $(CURDIR)/$@
utils/build-$@.sh $(SRCVERSION) $(DESTDIR)/nvml $(DESTDIR) $(CURDIR)/$@\
$(CURDIR)/src/test/testconfig.sh

install uninstall:
$(MAKE) -C src $@
Expand Down
14 changes: 10 additions & 4 deletions utils/build-dpkg.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e
#
# Copyright (c) 2014, Intel Corporation
# Copyright (c) 2014-2015, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -37,16 +37,18 @@
SCRIPT_DIR=$(dirname $0)
source $SCRIPT_DIR/pkg-common.sh

if [ "$#" != "4" ]
if [ $# -lt 4 -o $# -gt 5 ]
then
echo "Usage: $(basename $0) VERSION_TAG SOURCE_DIR WORKING_DIR OUT_DIR"
echo "Usage: $(basename $0) VERSION_TAG SOURCE_DIR WORKING_DIR"\
"OUT_DIR [TEST_CONFIG_FILE]"
exit 1
fi

PACKAGE_VERSION_TAG=$1
SOURCE=$2
WORKING_DIR=$3
OUT_DIR=$4
TEST_CONFIG_FILE=$5

function convert_changelog() {
while read line
Expand Down Expand Up @@ -224,7 +226,11 @@ override_dh_install:
override_dh_auto_test:
dh_auto_test
cp src/test/testconfig.sh.example src/test/testconfig.sh
if [ -f $TEST_CONFIG_FILE ]; then
cp $TEST_CONFIG_FILE src/test/testconfig.sh
else
cp src/test/testconfig.sh.example src/test/testconfig.sh
fi
make check
EOF

Expand Down
16 changes: 11 additions & 5 deletions utils/build-rpm.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e
#
# Copyright (c) 2014, Intel Corporation
# Copyright (c) 2014-2015, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -31,22 +31,24 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#
# build-rmp.sh - Script for building rpm packages
# build-rpm.sh - Script for building rpm packages
#

SCRIPT_DIR=$(dirname $0)
source $SCRIPT_DIR/pkg-common.sh

if [ "$#" != "4" ]
if [ $# -lt 4 -o $# -gt 5 ]
then
echo "Usage: $(basename $0) VERSION_TAG SOURCE_DIR WORKING_DIR OUT_DIR"
echo "Usage: $(basename $0) VERSION_TAG SOURCE_DIR WORKING_DIR"\
"OUT_DIR [TEST_CONFIG_FILE]"
exit 1
fi

PACKAGE_VERSION_TAG=$1
SOURCE=$2
WORKING_DIR=$3
OUT_DIR=$4
TEST_CONFIG_FILE=$5

function convert_changelog() {
while read
Expand Down Expand Up @@ -328,7 +330,11 @@ mkdir -p %{buildroot}/usr/share/nvml
cp utils/nvml.magic %{buildroot}/usr/share/nvml/
%check
cp src/test/testconfig.sh.example src/test/testconfig.sh
if [ -f $TEST_CONFIG_FILE ]; then
cp $TEST_CONFIG_FILE src/test/testconfig.sh
else
cp src/test/testconfig.sh.example src/test/testconfig.sh
fi
make check
%clean
Expand Down

0 comments on commit b6c7779

Please sign in to comment.