infra: Reworking kokoro scripts.

Signed-off-by: Tim 'mithro' Ansell <me@mith.ro>
This commit is contained in:
Tim 'mithro' Ansell 2019-02-03 14:44:35 +11:00
parent e6d737896f
commit 1991669e8c
8 changed files with 207 additions and 202 deletions

View File

@ -1,82 +1,61 @@
#!/bin/bash
set -x
set -e
sudo apt-get update
sudo apt-get install -y \
bison \
build-essential \
ca-certificates \
clang-format \
cmake \
curl \
flex \
fontconfig \
git \
jq \
psmisc \
python \
python3 \
python3-dev \
python3-virtualenv \
python3-yaml \
virtualenv \
ls -l ~/.Xilinx
sudo chown -R $USER ~/.Xilinx
CORES=$(nproc --all)
echo "----------------------------------------"
echo "----------------------------------------"
echo "----------------------------------------"
export
echo "----------------------------------------"
echo "----------------------------------------"
echo "----------------------------------------"
cat /proc/cpuinfo
echo "----------------------------------------"
echo "----------------------------------------"
echo "----------------------------------------"
find .
echo "----------------------------------------"
echo "----------------------------------------"
echo "----------------------------------------"
echo $PWD
echo "----------------------------------------"
cd github/$KOKORO_DIR/
git fetch --tags || true
git describe --tags || true
source ./.github/kokoro/steps/hostsetup.sh
source ./.github/kokoro/steps/hostinfo.sh
source ./.github/kokoro/steps/git.sh
# Build the C++ tools
make build --output-sync=target --warn-undefined-variables -j$CORES
source ./.github/kokoro/steps/xilinx.sh
# Setup the Python environment
make env --output-sync=target --warn-undefined-variables
source ./.github/kokoro/steps/prjxray-env.sh
echo
echo "========================================"
echo "Downloading current database"
echo "----------------------------------------"
echo "----------------------------------------"
(
./download-latest-db.sh
)
echo "----------------------------------------"
source settings/$XRAY_SETTINGS.sh
(
export XILINX_LOCAL_USER_DATA=no
cd fuzzers
make --warn-undefined-variables -j$CORES MAX_VIVADO_PROCESS=$CORES
)
# Output how the database differs
echo
echo "========================================"
echo "Cleaning out current database"
echo "----------------------------------------"
(
cd database
make clean-${XRAY_SETTINGS}-db
)
echo "----------------------------------------"
echo
echo "========================================"
echo "Running Database build"
echo "----------------------------------------"
(
cd fuzzers
echo "make --dry-run"
make --dry-run
echo "----------------------------------------"
export MAX_VIVADO_PROCESS=$CORES
set -x
make -j $CORES MAX_VIVADO_PROCESS=$CORES
set +x
echo "----------------------------------------"
echo "make --dry-run"
make --dry-run
)
echo "----------------------------------------"
echo
echo "========================================"
echo " Database Differences"
echo "----------------------------------------"
(
make formatdb
cd database
@ -92,5 +71,5 @@ source settings/$XRAY_SETTINGS.sh
echo " Database Diff"
echo "----------------------------------------"
git diff
echo "----------------------------------------"
)
echo "----------------------------------------"

View File

@ -1,77 +1,40 @@
#!/bin/bash
set -x
set -e
sudo apt-get update
sudo apt-get install -y \
bison \
build-essential \
ca-certificates \
clang-format \
cmake \
curl \
flex \
fontconfig \
git \
jq \
psmisc \
python \
python3 \
python3-dev \
python3-virtualenv \
python3-yaml \
virtualenv \
ls -l ~/.Xilinx
sudo chown -R $USER ~/.Xilinx
CORES=$(nproc --all)
echo "----------------------------------------"
echo "----------------------------------------"
echo "----------------------------------------"
export
echo "----------------------------------------"
echo "----------------------------------------"
echo "----------------------------------------"
cat /proc/cpuinfo
echo "----------------------------------------"
echo "----------------------------------------"
echo "----------------------------------------"
find .
echo "----------------------------------------"
echo "----------------------------------------"
echo "----------------------------------------"
echo $PWD
echo "----------------------------------------"
cd github/$KOKORO_DIR/
git fetch --tags || true
git describe --tags || true
source ./.github/kokoro/steps/hostsetup.sh
source ./.github/kokoro/steps/hostinfo.sh
source ./.github/kokoro/steps/git.sh
# Build the C++ tools
make build --output-sync=target --warn-undefined-variables -j$CORES
source ./.github/kokoro/steps/xilinx.sh
# Setup the Python environment
make env --output-sync=target --warn-undefined-variables
source ./.github/kokoro/steps/prjxray-env.sh
echo
echo "========================================"
echo "Downloading current database"
echo "----------------------------------------"
echo "----------------------------------------"
(
./download-latest-db.sh
)
echo "----------------------------------------"
source settings/$XRAY_SETTINGS.sh
echo
echo "========================================"
echo "Running quick Database build"
echo "----------------------------------------"
(
export XILINX_LOCAL_USER_DATA=no
cd fuzzers
make --warn-undefined-variables QUICK=y -j$CORES
echo "make --dry-run"
make --dry-run
echo "----------------------------------------"
export MAX_VIVADO_PROCESS=$CORES
set -x
make -j $CORES MAX_VIVADO_PROCESS=$CORES QUICK=y
set +x
)
echo "----------------------------------------"

27
.github/kokoro/steps/git.sh vendored Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
set -e
echo
echo "========================================"
echo "Git log"
echo "----------------------------------------"
echo "----------------------------------------"
echo
echo "========================================"
echo "Git fetching tags"
echo "----------------------------------------"
git fetch --tags || true
echo "----------------------------------------"
echo
echo "========================================"
echo "Git version info"
echo "----------------------------------------"
git log -n1
echo "----------------------------------------"
git describe --tags || true
echo "----------------------------------------"
git describe --tags --always || true
echo "----------------------------------------"

31
.github/kokoro/steps/hostinfo.sh vendored Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
set -e
echo
echo "========================================"
echo "Host Environment"
echo "----------------------------------------"
export
echo "----------------------------------------"
echo
echo "========================================"
echo "Host CPU"
echo "----------------------------------------"
export CORES=$(nproc --all)
echo "Cores: $CORES"
echo
echo "Memory"
echo "----------------------------------------"
cat /proc/meminfo
echo "----------------------------------------"
echo
echo "========================================"
echo "Host files"
echo "----------------------------------------"
echo $PWD
echo "----------------------------------------"
find . | sort
echo "----------------------------------------"

36
.github/kokoro/steps/hostsetup.sh vendored Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
set -e
echo
echo "========================================"
echo "Host updating packages"
echo "----------------------------------------"
sudo apt-get update
echo "----------------------------------------"
echo
echo "========================================"
echo "Host install packages"
echo "----------------------------------------"
sudo apt-get install -y \
bison \
build-essential \
ca-certificates \
clang-format \
cmake \
curl \
flex \
fontconfig \
git \
jq \
psmisc \
python \
python3 \
python3-dev \
python3-virtualenv \
python3-yaml \
virtualenv \
echo "----------------------------------------"

16
.github/kokoro/steps/prjxray-env.sh vendored Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
set -e
echo
echo "========================================"
echo "Build the C++ tools"
echo "----------------------------------------"
make build --output-sync=target --warn-undefined-variables -j $CORES
echo "----------------------------------------"
echo
echo "========================================"
echo "Setup the Python environment"
echo "----------------------------------------"
make env --output-sync=target --warn-undefined-variables

8
.github/kokoro/steps/xilinx.sh vendored Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
# Fix up things related to Xilinx tool chain.
ls -l ~/.Xilinx
sudo chown -R $USER ~/.Xilinx
export XILINX_LOCAL_USER_DATA=no

View File

@ -1,88 +1,33 @@
#!/bin/bash
set -x
set -e
sudo apt-get update
sudo apt-get install -y \
bison \
build-essential \
ca-certificates \
clang-format \
cmake \
curl \
flex \
fontconfig \
git \
jq \
psmisc \
python \
python3 \
python3-dev \
python3-virtualenv \
python3-yaml \
virtualenv \
echo "----------------------------------------"
echo "----------------------------------------"
echo "----------------------------------------"
export
echo "----------------------------------------"
echo "----------------------------------------"
echo "----------------------------------------"
cat /proc/cpuinfo
echo "----------------------------------------"
echo "----------------------------------------"
echo "----------------------------------------"
find .
echo "----------------------------------------"
echo "----------------------------------------"
echo "----------------------------------------"
echo $PWD
echo "----------------------------------------"
cd github/$KOKORO_DIR/
git fetch --tags || true
git describe --tags || true
source ./.github/kokoro/steps/hostsetup.sh
source ./.github/kokoro/steps/hostinfo.sh
source ./.github/kokoro/steps/git.sh
# Build the C++ tools
make build --output-sync=target --warn-undefined-variables
# Setup the Python environment
make env --output-sync=target --warn-undefined-variables
source ./.github/kokoro/steps/prjxray-env.sh
echo
echo "========================================"
echo "Running tests"
echo "----------------------------------------"
echo "----------------------------------------"
(
make test --output-sync=target --warn-undefined-variables
)
echo "----------------------------------------"
find .
echo "----------------------------------------"
echo "----------------------------------------"
echo "----------------------------------------"
# Run the tests
make test --output-sync=target --warn-undefined-variables
echo "----------------------------------------"
echo "----------------------------------------"
echo "----------------------------------------"
cat build/*test_results.xml
mkdir build/py
cp build/py_test_results.xml build/py/sponge_log.xml
mkdir build/cpp
cp build/cpp_test_results.xml build/cpp/sponge_log.xml
echo "----------------------------------------"
echo
echo "========================================"
echo "Copying tests logs"
echo "----------------------------------------"
(
cat build/*test_results.xml
mkdir build/py
cp build/py_test_results.xml build/py/sponge_log.xml
mkdir build/cpp
cp build/cpp_test_results.xml build/cpp/sponge_log.xml
)
echo "----------------------------------------"