Skip to content
Snippets Groups Projects
Commit c5624017 authored by Clark Coleman's avatar Clark Coleman
Browse files

Merge branch 'STARS-CICD' into 'master'

Stars CICD

See merge request allnp/SMPStaticAnalyzer!17
parents 63c3799f a030a765
No related branches found
No related tags found
1 merge request!17Stars CICD
Pipeline #2892 passed
before_script:
- "source ~gitlab-runner/cicd_support/cicd_support.shinc"
after_script:
- "echo Test Complete."
stages:
- clean
- build
- test
#
# Cleaning
#
#template
.do-clean: &do-nightly-clean
stage: clean
script:
- ./cicd_testing/do-clean.sh
# per os items
do-nightly-clean-ubuntu18:
<<: *do-nightly-clean
tags:
- ubuntu18
variables:
OS: 'ubuntu18'
do-nightly-clean-ubuntu16:
<<: *do-nightly-clean
tags:
- ubuntu16
variables:
OS: 'ubuntu16'
do-nightly-clean-centos75:
<<: *do-nightly-clean
tags:
- centos75
variables:
OS: 'centos75'
#
# building
#
# template
.do-build: &do-build
stage: build
script:
- ./cicd_testing/do-build.sh
# per os items
do-build-ubuntu18:
<<: *do-build
tags:
- ubuntu18
variables:
OS: 'ubuntu18'
do-build-ubuntu16:
<<: *do-build
tags:
- ubuntu16
variables:
OS: 'ubuntu16'
do-build-centos75:
<<: *do-build
tags:
- centos75
variables:
OS: 'centos75'
#
# $PSZ ls
#
# template
.xform-ls: &xform-ls
stage: test
script:
- ./cicd_testing/xform-ls.sh
#per OS
xform-ls-ubuntu18:
<<: *xform-ls
tags:
- ubuntu18
variables:
OS: 'ubuntu18'
xform-ls-ubuntu16:
<<: *xform-ls
tags:
- ubuntu16
variables:
OS: 'ubuntu16'
xform-ls-centos75:
<<: *xform-ls
tags:
- centos75
variables:
OS: 'centos75'
#!/bin/sh
# Make terminal ansi-color
export TVOPT=ansi
# Fix screwed-up LD environment on power machines.
# export LD_LIBRARY_PATH=/uf1/jdh8d/RA/NICECAP/idapro_lib/
export LD_LIBRARY_PATH=${IDAROOT}
# Set IDA path.
export IDADIR=$IDAROOT
# Make sure that the idal executable can be reached from PATH.
export PATH=$PATH:$IDADIR
export STARS_ROOT_FILENAME=$1
export IDALOG=$1.log
# export IDALOG_SILENT=1
# Extract the code addresses with objdump.
objdump -d --prefix-addresses $1 | grep "^[0-9]" > $1.SMPobjdump
# Extract the exception-handling function target addresses.
# dwarfdump -F $1 | grep "^<" | cut --delimiter="<" --field=3 | cut --delimiter=":" --field=1 | cut --bytes 4-10 > $1.eh_frame_addrs
# Make readelf do the same thing as the above dwarfdump command, to
# eliminate configuration dependence on dwarfdump.
readelf -wF $1 | grep "pc=" | cut --delimiter="=" --field=3 | cut --delimiter="." --field=1 > $1.eh_frame_addrs
if [ "${IDAROOT}"X = "X" ]; then echo Please set IDAROOT; exit 1; fi
if [ ! -f ${IDAROOT}/libida.so ]; then echo IDAROOT is set poorly, please fix.; exit 1; fi
# remove tmp files
rm -f $1.id? $1.{i64,nam,til,log,syms}
rm -f `basename $1 .psexe`.{i64,nam,til} `basename $1 .psexe`.id?
rm -f `basename $1 .ncexe`.{i64,nam,til} `basename $1 .ncexe`.id?
rm -f `basename $1 .exe`.{i64,nam,til} `basename $1 .exe`.id?
old_stty=`stty -g`
# Run the linux IDA Pro with the SMPStaticAnalyzer plugin.
# jdh - added -B for batch mode, avoids any prompts.
# jdh - note: can't use -B, as the plugin doesn't run!
# TVHEADLESS=1 time ${IDAROOT}/idat64 -A -Telf -OSMPStaticAnalyzer:run $1 2>&1 >/dev/null
# TVHEADLESS=1 time ${IDAROOT}/idat64 -A -SSMP.idc -OSMPStaticAnalyzer:ShadowFuncPtrs:ShadowArgs:ImproveCFG:AnalyzeLoops:SCCP:NoGenAsm $1 > $1.idaoutput
TVHEADLESS=1 time ${IDAROOT}/idat64 -A -SSMP7noasm.idc -OSMPStaticAnalyzer:ShadowFuncPtrs:ShadowArgs:ImproveCFG:AnalyzeLoops:SCCP:NoGenAsm $1 > $1.idaoutput
# TVHEADLESS=1 time ${IDAROOT}/idat64 -A -SSMP7.idc -OSMPStaticAnalyzer:ShadowFuncPtrs:ShadowArgs:ImproveCFG:AnalyzeLoops:SCCP:NoGenAsm $1 > $1.idaoutput
# TVHEADLESS=1 valgrind -v --leak-check=full --show-reachable=yes --track-origins=yes --log-file=$1.valgrind.log ${IDAROOT}/idat64 -A -SSMP7.idc $1
# SMP seems to mess up the terminal, using this to fix it.
/usr/bin/reset
stty $old_stty
# Get the output file SMP.syms into $1.syms.
# mv SMP.annot $1.annot
#/bin/bash
set -e
set -x
main()
{
# update submodules
git submodule sync --recursive
git submodule update --recursive --init
# gather info for debugging later, probably not necessary
pwd
hostname
whoami
env|grep "^CICD"
local orig_dir=$(pwd)
# puts peasoup_umbrella (and all submodules) in CICD_MODULE_WORK_DIR
cicd_setup_module_dependency allnp/peasoup_umbrella.git stars_umbrella
# puts the version of zipr to test in stars_umbrella/SMPStaticAnalyzer.
cicd_put_module_in_tree stars_umbrella/SMPStaticAnalyzer
# Build peasoup_umbrella as stars_umbrella
cd $CICD_MODULE_WORK_DIR/stars_umbrella
source set_env_vars
sudo ./get-peasoup-packages.sh all
./build-all.sh
dropdb $PGDATABASE 2>/dev/null || true ; ./postgres_setup.sh
cd $orig_dir
}
main "$@"
#/bin/bash
set -e
set -x
main()
{
# gather info for debugging later, probably not necessary
pwd
hostname
whoami
env|grep "^CICD"
if [[ $CICD_NIGHTLY == 1 ]] ; then
rm -rf $CICD_MODULE_WORK_DIR/stars_umbrella
fi
}
main "$@"
#!/bin/bash
# Usage:
function validate {
if grep "FROMIB COMPLETE 20 SWITCHTABLE" $1.STARSxrefs > /dev/null; then
if grep "FROMIB COMPLETE 1 RETURNTARGET" $1.STARSxrefs > /dev/null; then
if tail $1.infoannot | grep "SUCCESS ANALYSISCOMPLETED" > /dev/null; then
echo "STARS success"
exitstatus=0
else
echo "Failed to find SUCCESS ANALYSISCOMPLETED annotation"
exitstatus=1
fi
else
echo "Failed to find any COMPLETE RETURNTARGET xref annotations"
exitstatus=2
fi
else
echo "Failed to find COMPLETE 20 SWITCHTABLE xref annotation"
exitstatus=3
fi
return $exitstatus
}
function test {
./$SMPSA_HOME/SMP-fullanalyze64-ida7.sh $1
validate $1
}
# Pass in optimization level string, e.g. O0, Og, or O3
function build {
rm -f starstest_$1.exe
gcc -m64 -$1 -o starstest_$1.exe $SMPSA_HOME/tests/starstest.c
}
# Pass in optimization level string, e.g. O0, Og, or O3
function build_and_test {
build $1
test starstest_$1.exe
}
# Build and test each of the optimization levels -O0, -Og, and -O3.
if build_and_test O0 ; then
if build_and_test Og ; then
build_and_test O3
fi
fi
#!/bin/bash
set -e
set -x
cd $CICD_MODULE_WORK_DIR/stars_umbrella
source set_env_vars
cd /tmp
rm -rf ls.stars.killdeads stars_ped_ls; $PSZ /bin/ls ./ls.stars.killdeads -c rida=on -s meds_static=off -c kill_deads=on --tempdir stars_ped_ls || true
if [[ ! -x ./ls.stars.killdeads ]]; then cat stars_ped_ls/logs/*; fi
rm -rf stars_ped_ls
./ls.stars.killdeads
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