Blame OpenIb_Host/build_tests.sh

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