summaryrefslogtreecommitdiffstats
path: root/sbe/build
diff options
context:
space:
mode:
authorSachin Gupta <sgupta2m@in.ibm.com>2015-09-23 05:09:17 -0500
committerAmit J. Tendolkar <amit.tendolkar@in.ibm.com>2015-11-16 00:25:50 -0600
commit88f4efefa579dc33953936817b3e8d6ddf1d651f (patch)
tree35af4c2409b79b34c83cc69ec8e0f34662401ebd /sbe/build
parentdeb3046d088210c2af9c6e3f49f1155969702d27 (diff)
downloadtalos-sbe-88f4efefa579dc33953936817b3e8d6ddf1d651f.tar.gz
talos-sbe-88f4efefa579dc33953936817b3e8d6ddf1d651f.zip
CI Test infrastructure support
RTC: 123606 Change-Id: Icf1410c21a9b5691d3b6ea9b54e2507acef61a5d Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/20724 Tested-by: Jenkins Server Reviewed-by: Basabjit Sengupta <basengup@in.ibm.com> Reviewed-by: Amit J. Tendolkar <amit.tendolkar@in.ibm.com>
Diffstat (limited to 'sbe/build')
-rwxr-xr-xsbe/build/citest/autocitest70
-rwxr-xr-xsbe/build/citest/build-script58
-rwxr-xr-xsbe/build/citest/create-sandbox48
-rw-r--r--sbe/build/citest/etc/patches/patchlist.txt6
-rwxr-xr-xsbe/build/citest/etc/workarounds.postsimsetup11
-rwxr-xr-xsbe/build/citest/etc/workarounds.presimsetup9
-rwxr-xr-xsbe/build/citest/populate-sandbox21
-rwxr-xr-xsbe/build/citest/sbetest-start.sh15
-rwxr-xr-xsbe/build/citest/setup-env63
9 files changed, 301 insertions, 0 deletions
diff --git a/sbe/build/citest/autocitest b/sbe/build/citest/autocitest
new file mode 100755
index 00000000..9197fb70
--- /dev/null
+++ b/sbe/build/citest/autocitest
@@ -0,0 +1,70 @@
+#!/bin/bash
+################################################################################
+## Simics automation using run-fsp-it
+################################################################################
+
+## verbose is the default.
+VERBOSE=" --verbose"
+if [ "$1" = "--quiet" ] ; then
+ VERBOSE=""
+ shift
+fi
+
+##
+## set up
+##
+DRIVER="$1" ## backing tree
+export bb=$DRIVER ## simulate a workon
+
+export SHELL="/bin/bash" ## Needed to fool workon to launch a bash
+ ## shell, which autosim expects.
+NOWIN="--nowin" ## remote execution does not have a display
+
+## jenkins creates a new workspace for every compile.
+## sbetest-start.sh will verify this and then export WORKSPACE_DIR for us.
+SBXHOME=$SBEROOT
+
+if [ "$DRIVER" = "" ] ; then
+ echo "ERROR: you must specify a driver (backing tree) to run the tests with"
+ usage
+ exit 1
+fi
+
+## let's get set up
+cd $SANDBOXROOT
+
+echo "$0"
+echo "VERBOSE = $VERBOSE"
+echo "NOWIN = $NOWIN"
+echo "BACKING_TREE = $DRIVER"
+echo "SANDBOXRC = $SANDBOXRC"
+echo "SBXHOME = $SBXHOME"
+echo "AUTOSIM_FFDC_XML = $AUTOSIM_FFDC_XML"
+echo "current directory is " `pwd`
+
+
+timestamp=`date +'%H:%M:%S'`
+echo "$timestamp Starting SBE test..."
+
+# Check preconditions for run-fsp-it
+mkdir -p ~/private
+if [ ! -f ~/private/.p ]; then
+ echo "Creating p file"
+ touch ~/private/.p
+fi
+
+if [ ! -f ~/private/password ]; then
+ echo "Creating passwd file"
+ touch ~/private/password
+ # This is just workaround. It is expected
+ # that user already either have this file
+ # or tokens have been taken by klog command.
+ # This is just to make run-fsp-it work in user
+ # sandbox
+ echo "dummy" > ~/private/password
+fi
+
+execute_in_sandbox "run-fsp-it $NOWIN --machine $MACHINE $SBE_TEST_XML" "ppc" || exit -1
+
+exit 0
+
diff --git a/sbe/build/citest/build-script b/sbe/build/citest/build-script
new file mode 100755
index 00000000..4d6775b9
--- /dev/null
+++ b/sbe/build/citest/build-script
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+if [ -z $WORKSPACE ]; then
+ export WORKSPACE=`pwd`
+fi
+
+if [ -z $SBEROOT ]; then
+ source "$WORKSPACE/env.bash"
+fi
+
+source "$SBEROOT/sbe/build/citest/setup-env"
+
+# @TODO via RTC 140875
+#Enable it once SBE copyright script is ready
+# Check copyright.
+#check-copyright > copyright.log 2>&1 &
+#COPYRIGHT_PID=$!
+
+
+# Build .
+cd sbe/image
+scl enable devtoolset-2 " bash -c \"make all\"" || exit -1
+make tracehash || exit -1
+cd -
+
+#@ TODO via RTC 123606
+# Enable this in another case
+# Create simics sandbox.
+#create-sandbox > create-sandbox.log 2>&1 &
+#CREATESANDBOX_PID=$!
+
+# Check sandbox create completion.
+#wait $CREATESANDBOX_PID
+#if [ $? -eq 0 ]; then
+# cat create-sandbox.log
+#else
+# echo "----Sandbox creation failed."
+# cat create-sandbox.log
+# exit -1
+#fi
+
+# Add SBE files to simics sandbox.
+#populate-sandbox || exit -1
+
+#sbetest-start.sh || exit -1
+
+# @TODO via RTC 140875
+#Enable it once SBE copyright script is ready
+# Check copyright completion.
+#wait $COPYRIGHT_PID
+#if [ $? -eq 0 ]; then
+# cat copyright.log
+#else
+# echo "----Copyright check failed."
+# cat copyright.log
+# exit -1
+#fi
+
diff --git a/sbe/build/citest/create-sandbox b/sbe/build/citest/create-sandbox
new file mode 100755
index 00000000..98e59afd
--- /dev/null
+++ b/sbe/build/citest/create-sandbox
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+echo "Creating ODE sandbox..."
+
+# Ensure backing build is accessible.
+if [ ! -d "$BACKING_BUILD" ];
+then
+ echo "Cannot access the backing build: $BACKING_BUILD"
+ exit -1
+fi
+
+# Delete existing sandbox if it exists.
+if [ -d "$SANDBOXBASE" ];
+then
+ echo "----Removing old sandbox."
+ mksb -undo -auto -rc $SANDBOXRC -dir $SANDBOXROOT -sb $SANDBOXNAME
+fi
+if [ -d "$SANDBOXBASE" ];
+then
+ rm -rf $SANDBOXBASE
+fi
+
+# Create sandbox.
+mksb -rc $SANDBOXRC -dir $SANDBOXROOT -back $BACKING_BUILD -sb $SANDBOXNAME \
+ -m ppc -auto || exit -1
+
+# workaround scripts expect $sb variable to be populated.
+export sb=$SANDBOXBASE/src
+
+# Run presimsetup workarounds.
+echo "----Running presimsetup workarounds."
+if [ -f ${CITESTPATH}/etc/workarounds.presimsetup ];
+then
+ ${CITESTPATH}/etc/workarounds.presimsetup || exit -1
+fi
+
+# Run start_simics to populate simics directories.
+echo "----Setting up simics."
+execute_in_sandbox "start_simics -no_start -machine $MACHINE -batch_mode" \
+ "ppc" || exit -1
+
+# Run postsimsetup workarounds.
+echo "----Running postsimsetup workarounds."
+if [ -f ${CITESTPATH}/etc/workarounds.postsimsetup ];
+then
+ ${CITESTPATH}/etc/workarounds.postsimsetup || exit -1
+fi
+
diff --git a/sbe/build/citest/etc/patches/patchlist.txt b/sbe/build/citest/etc/patches/patchlist.txt
new file mode 100644
index 00000000..5bf8c309
--- /dev/null
+++ b/sbe/build/citest/etc/patches/patchlist.txt
@@ -0,0 +1,6 @@
+# Example Format
+Brief description of the problem or reason for patch
+-RTC: Task/Story used to remove this patch
+-CQ: Defect/Req for checking the changes into fips910
+-Files: list of files
+-Coreq: list of associated changes, e.g. workarounds.presimsetup
diff --git a/sbe/build/citest/etc/workarounds.postsimsetup b/sbe/build/citest/etc/workarounds.postsimsetup
new file mode 100755
index 00000000..e19a6c02
--- /dev/null
+++ b/sbe/build/citest/etc/workarounds.postsimsetup
@@ -0,0 +1,11 @@
+#!/bin/sh
+## Workarounds that are run after start_simics is executed for the first time
+## to setup the sandbox
+##
+
+### Example applying a patch to cec-chip files
+#echo "+++ Updating something wonderful in a simics file"
+#mkdir -p $sb/simu/data/cec-chip/
+#cp $BACKING_BUILD/src/simu/data/cec-chip/base_cec_chip_file $sb/simu/data/cec-chip
+#patch -p0 $sb/simu/data/cec-chip/base_cec_chip_file $HOSTBOOTROOT/src/build/citest/etc/patches/my_patch_File
+
diff --git a/sbe/build/citest/etc/workarounds.presimsetup b/sbe/build/citest/etc/workarounds.presimsetup
new file mode 100755
index 00000000..b1db34de
--- /dev/null
+++ b/sbe/build/citest/etc/workarounds.presimsetup
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+#### Examples ####
+#echo "+++ Some message about why you need to do this."
+#mkdir -p $sb/simu/data
+#egrep -v "WSALIAS DEFAULT FIPSLEVEL|WSALIAS DEFAULT SIMICSLEVEL" $BACKING_BUILD/src/simu/data/simicsInfo > $sb/simu/data/simicsInfo
+#echo "WSALIAS DEFAULT FIPSLEVEL env/gfwb/simics-4.2.0/simics-4.2.83/fips/fld36/fi120201a700.42" >> $sb/simu/data/simicsInfo
+#echo "WSALIAS DEFAULT SIMICSLEVEL env/vtechb/simics-4.2.0/simics-4.2.83/bin" >> $sb/simu/data/simicsInfo
+
diff --git a/sbe/build/citest/populate-sandbox b/sbe/build/citest/populate-sandbox
new file mode 100755
index 00000000..4af967d5
--- /dev/null
+++ b/sbe/build/citest/populate-sandbox
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# Ensure sandbox exists (create-sandbox has been called).
+if [ -z $SANDBOXBASE ];
+then
+ echo "SANDBOXBASE variable uninitialized.."
+ exit -1
+fi
+
+if [ ! -d "$SANDBOXBASE" ];
+then
+ echo "Cannot find sandbox: $SANDBOXBASE"
+ exit -1
+fi
+
+# Create img directory.
+mkdir -p $SBETESTDIR || exit -1
+
+# Copy files.
+
+cp $SBEROOT/sbe/test/* $SBETESTDIR/ || exit -1
diff --git a/sbe/build/citest/sbetest-start.sh b/sbe/build/citest/sbetest-start.sh
new file mode 100755
index 00000000..24e661e1
--- /dev/null
+++ b/sbe/build/citest/sbetest-start.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+if [ -z $SBE_CI_ENV_SETUP ];
+then
+ unset $SANDBOXBASE
+ unset $SANDBOXNAME
+ source "$SBEROOT/sbe/build/citest/setup-env"
+fi
+
+# Front end to autocitest - script to execute unit tests under simics.
+#
+## when jenkins runs it will create a workspace with the built code tree
+## and drop us into it.
+autocitest ${BACKING_BUILD}
+
+exit $?
diff --git a/sbe/build/citest/setup-env b/sbe/build/citest/setup-env
new file mode 100755
index 00000000..4d458700
--- /dev/null
+++ b/sbe/build/citest/setup-env
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+export CITESTPATH=${SBEROOT}/sbe/build/citest
+export PATH=${CITESTPATH}:${PATH}
+export SBE_IMG_OUT_LOC=${SBEROOT}/sbe/obj;
+export SBE_IMG_BIN_LOC=${SBEROOT}/sbe/obj;
+# If we are running under Jenkins we need to pick a random-ish sandbox name
+# so that the autoipl tools do not have a /tmp name collision.
+if [ -z $JOB_NAME -o -z $BUILD_NUMBER ];
+then
+ SBECI_SANDBOX="test_sb"
+else
+ export RUNNING_UNDER_JENKINS=1
+ SBECI_SANDBOX=`echo $JOB_NAME $BUILD_NUMBER | md5sum | head -c10`
+fi
+
+# Setup sandbox location variables.
+if [ -z $SANDBOXROOT ];
+then
+ export SANDBOXROOT=${SBEROOT}
+fi
+
+if [ -z $SANDBOXNAME ];
+then
+ export SANDBOXNAME=${SBECI_SANDBOX}
+fi
+if [ -z $SANDBOXBASE ];
+then
+ export SANDBOXBASE=${SANDBOXROOT}/${SANDBOXNAME}
+fi
+
+if [ -z $SANDBOXRC ];
+then
+ export SANDBOXRC=${SANDBOXROOT}/sbesandboxrc
+fi
+
+# Useful utility function.
+execute_in_sandbox()
+{
+ WORKON_CMD="workon -rc ${SANDBOXRC} -sb ${SANDBOXNAME} -m $2 "
+ echo $1 > ${SANDBOXBASE}/src/sandbox_execute_cmd
+ chmod 700 ${SANDBOXBASE}/src/sandbox_execute_cmd
+
+ TEST="${WORKON_CMD} -c ./sandbox_execute_cmd "
+ echo $TEST
+ ${WORKON_CMD} -c ./sandbox_execute_cmd
+
+ if [ $? -ne 0 ]; then
+ return 1
+ fi
+
+ rm ${SANDBOXBASE}/src/sandbox_execute_cmd
+}
+export -f execute_in_sandbox
+
+# Setup machine type.
+export MACHINE=${MACHINE:-$DEFAULT_MACHINE}
+
+export SBETESTDIR=$SANDBOXBASE/simics/targets/p9_nimbus/sbeTest
+export AUTOSIM_FFDC_XML=$SBETESTDIR/ffdc.xml
+export SBE_TEST_XML=$SBETESTDIR/test.xml
+# Indicate we setup the CI environment.
+export SBE_CI_ENV_SETUP=1
OpenPOWER on IntegriCloud