Blame OpenIb_Host/build_tests.sh

Packit 857059
#!/bin/bash
Packit 857059
# BEGIN_ICS_COPYRIGHT8 ****************************************
Packit 857059
# 
Packit 857059
# Copyright (c) 2015-2017, Intel Corporation
Packit 857059
# 
Packit 857059
# Redistribution and use in source and binary forms, with or without
Packit 857059
# modification, are permitted provided that the following conditions are met:
Packit 857059
# 
Packit 857059
#     * Redistributions of source code must retain the above copyright notice,
Packit 857059
#       this list of conditions and the following disclaimer.
Packit 857059
#     * Redistributions in binary form must reproduce the above copyright
Packit 857059
#       notice, this list of conditions and the following disclaimer in the
Packit 857059
#       documentation and/or other materials provided with the distribution.
Packit 857059
#     * Neither the name of Intel Corporation nor the names of its contributors
Packit 857059
#       may be used to endorse or promote products derived from this software
Packit 857059
#       without specific prior written permission.
Packit 857059
# 
Packit 857059
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Packit 857059
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit 857059
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Packit 857059
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
Packit 857059
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 857059
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Packit 857059
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Packit 857059
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Packit 857059
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Packit 857059
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit 857059
# 
Packit 857059
# END_ICS_COPYRIGHT8   ****************************************
Packit 857059
Packit 857059
#[ICS VERSION STRING: unknown]
Packit 857059
Packit 857059
Usage()
Packit 857059
{
Packit 857059
	echo "build_tests.sh [-C]" >&2
Packit 857059
	exit 2
Packit 857059
}
Packit 857059
Packit 857059
Cflag=n
Packit 857059
rerun=n
Packit 857059
while getopts rC param
Packit 857059
do
Packit 857059
	case $param in
Packit 857059
	r)	rerun=y;;
Packit 857059
	C)	Cflag=y;;
Packit 857059
	?)	Usage;;
Packit 857059
	esac
Packit 857059
done
Packit 857059
Packit 857059
set -x
Packit 857059
wd=$PWD
Packit 857059
testdir=$wd/tests_build
Packit 857059
Packit 857059
# TBD - maybe there can be a better way
Packit 857059
# this copies the relevant directories to a place where we can do the
Packit 857059
# build, this avoids clutter in the main tree and hence avoids clutter
Packit 857059
# in the FF src.rpm, but it is creating extra copies of things which clutter
Packit 857059
# any searches from the top of the tree
Packit 857059
# perhaps we should rename testsdir to a dot filename or a different tree
Packit 857059
if [ "$Cflag" != y ]
Packit 857059
then
Packit 857059
	# clobber old tree
Packit 857059
	rm -rf $testdir
Packit 857059
fi
Packit 857059
mkdir -p $testdir
Packit 857059
cp Makefile.tests $testdir/Makefile
Packit 857059
cp *.project setenv $testdir
Packit 857059
cd $TL_DIR
Packit 857059
# -p will preserve timestamps (and ownership, etc) so that we will
Packit 857059
# not rebuild unless we need to
Packit 857059
cp -r -p Makerules MakeTools opamgt Xml Topology SrpTools InicTools Tests IbaTests IbaTools IbAccess MpiApps Fd $testdir
Packit 857059
if [ "$Cflag" = y ]
Packit 857059
then
Packit 857059
	# if in-place FF build left builtbin, builtinclude and builtlibs, pick
Packit 857059
	# them up to accelerate incremental builds
Packit 857059
	for i in builtbin builtinclude builtlibs
Packit 857059
	do
Packit 857059
		if [ -e $i.$PRODUCT.$BUILD_CONFIG ]
Packit 857059
		then
Packit 857059
			cp -r -p $i.$PRODUCT.$BUILD_CONFIG $testdir
Packit 857059
		fi
Packit 857059
	done
Packit 857059
fi
Packit 857059
Packit 857059
Packit 857059
cd $testdir
Packit 857059
export PROJ_FILE_DIR=.
Packit 857059
set +x
Packit 857059
. setenv
Packit 857059
set -x
Packit 857059
showenv
Packit 857059
# TBD the code below should be moved back into the LINUX/Makefile as part of a
Packit 857059
# package_tests target, then this can run make stage prepfiles package_tests
Packit 857059
# and also avoid editing Makerules.project
Packit 857059
sed -i 's/IntelOPA-Tools-FF/IntelOPA-Tests/' Makerules.project
Packit 857059
make stage 2>&1 | tee make.res
Packit 857059
#make prepfiles 2>&1 | tee make.res	# TBD should be enabled
Packit 857059
if [ "x$RELEASE_TAG" = "x" ]
Packit 857059
then
Packit 857059
	STAGE_SUB_DIR=IntelOPA-Tests.$(MakeTools/patch_engineer_version.sh|cut -d"." -f1)
Packit 857059
else
Packit 857059
	STAGE_SUB_DIR=IntelOPA-Tests.$(format_releasetag $RELEASE_TAG)
Packit 857059
fi
Packit 857059
tarstage=$PWD/tarStage/$STAGE_SUB_DIR
Packit 857059
mkdir -p $tarstage
Packit 857059
if [ "x$PRODUCT" = "x" ]
Packit 857059
then
Packit 857059
	stagedir=stage.tests_build.$BUILD_CONFIG
Packit 857059
else
Packit 857059
	stagedir=stage.$PRODUCT.$BUILD_CONFIG
Packit 857059
fi
Packit 857059
tarbase=$(find $stagedir -name "IntelOPA-Tests*")
Packit 857059
cd $tarbase
Packit 857059
cd Tests
Packit 857059
cp -r * $tarstage
Packit 857059
cd ..
Packit 857059
cp version $tarstage
Packit 857059
cd $tarstage
Packit 857059
cd ..
Packit 857059
tar cfz $STAGE_SUB_DIR.tgz $STAGE_SUB_DIR
Packit 857059
echo $PWD/$STAGE_SUB_DIR.tgz >>  $TL_DIR/../dist_files
Packit 857059
echo $PWD/$STAGE_SUB_DIR.tgz >>  $TL_DIR/../packaged_files