add cleanup script | fix verilator unknown bin

This commit is contained in:
abejgonzalez 2019-07-09 23:38:25 -07:00
parent 72f4941d4b
commit 82e7814205
4 changed files with 46 additions and 8 deletions

View File

@ -12,6 +12,8 @@ source $SCRIPT_DIR/defaults.sh
# call clean on exit # call clean on exit
trap clean EXIT trap clean EXIT
run_script $LOCAL_CHIPYARD_DIR/.circleci/clean-old-files.sh
if [ ! -d "$LOCAL_VERILATOR_DIR" ]; then if [ ! -d "$LOCAL_VERILATOR_DIR" ]; then
# set stricthostkeychecking to no (must happen before rsync) # set stricthostkeychecking to no (must happen before rsync)
run "echo \"Ping $SERVER\"" run "echo \"Ping $SERVER\""
@ -28,4 +30,6 @@ if [ ! -d "$LOCAL_VERILATOR_DIR" ]; then
mkdir -p $LOCAL_VERILATOR_DIR mkdir -p $LOCAL_VERILATOR_DIR
copy $SERVER:$REMOTE_CHIPYARD_DIR/ $LOCAL_CHIPYARD_DIR copy $SERVER:$REMOTE_CHIPYARD_DIR/ $LOCAL_CHIPYARD_DIR
copy $SERVER:$REMOTE_VERILATOR_DIR/ $LOCAL_VERILATOR_DIR copy $SERVER:$REMOTE_VERILATOR_DIR/ $LOCAL_VERILATOR_DIR
cp -r $LOCAL_VERILATOR_DIR/install/bin/* $LOCAL_VERILATOR_DIR/install/share/verilator/bin/.
fi fi

30
.circleci/clean-old-files.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
# clean directories that are older than 30 days
# get shared variables
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source $SCRIPT_DIR/defaults.sh
age () {
local AGE_SEC
local CUR_SEC
local DIFF_SEC
local SEC_PER_DAY
SEC_PER_DAY=86400
CUR_SEC=$(date +%s)
AGE_SEC=$(stat -c %Y -- "$1")
DIFF_SEC=$(expr $CUR_SEC - $AGE_SEC)
echo $(expr $DIFF_SEC / $SEC_PER_DAY)
}
for d in $CI_DIR/*/ ; do
DIR_AGE="$(age $d)"
if [ $DIR_AGE -ge 30 ]; then
echo "Deleting $d since is it $DIR_AGE old"
rm -rf $d
fi
done

View File

@ -78,14 +78,14 @@ jobs:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }}
- run: - run:
name: Build Verilator name: Build Verilator
command: | command: |
.circleci/build-verilator.sh .circleci/build-verilator.sh
no_output_timeout: 120m no_output_timeout: 120m
- save_cache: - save_cache:
key: verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} key: verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }}
paths: paths:
- "/home/riscvuser/verilator" - "/home/riscvuser/verilator"
prepare-example: prepare-example:
@ -108,7 +108,7 @@ jobs:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
- restore_cache: - restore_cache:
keys: keys:
- verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }}
- run: - run:
name: Building the example subproject using Verilator name: Building the example subproject using Verilator
command: .circleci/do-rtl-build.sh SUB_PROJECT=example command: .circleci/do-rtl-build.sh SUB_PROJECT=example
@ -137,7 +137,7 @@ jobs:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
- restore_cache: - restore_cache:
keys: keys:
- verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }}
- run: - run:
name: Building the boomexample subproject using Verilator name: Building the boomexample subproject using Verilator
command: .circleci/do-rtl-build.sh SUB_PROJECT=example CONFIG=SmallDefaultBoomConfig command: .circleci/do-rtl-build.sh SUB_PROJECT=example CONFIG=SmallDefaultBoomConfig
@ -166,7 +166,7 @@ jobs:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
- restore_cache: - restore_cache:
keys: keys:
- verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }}
- run: - run:
name: Building the boomrocketexample subproject using Verilator name: Building the boomrocketexample subproject using Verilator
command: .circleci/do-rtl-build.sh SUB_PROJECT=example CONFIG=SmallDefaultBoomAndRocketConfig command: .circleci/do-rtl-build.sh SUB_PROJECT=example CONFIG=SmallDefaultBoomAndRocketConfig
@ -195,7 +195,7 @@ jobs:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
- restore_cache: - restore_cache:
keys: keys:
- verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }}
- run: - run:
name: Building the boom subproject using Verilator name: Building the boom subproject using Verilator
command: .circleci/do-rtl-build.sh SUB_PROJECT=boom command: .circleci/do-rtl-build.sh SUB_PROJECT=boom
@ -224,7 +224,7 @@ jobs:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
- restore_cache: - restore_cache:
keys: keys:
- verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }}
- run: - run:
name: Building the rocketchip subproject using Verilator name: Building the rocketchip subproject using Verilator
command: .circleci/do-rtl-build.sh SUB_PROJECT=rocketchip command: .circleci/do-rtl-build.sh SUB_PROJECT=rocketchip
@ -253,7 +253,7 @@ jobs:
- riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }}
- restore_cache: - restore_cache:
keys: keys:
- verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }}
- run: - run:
name: Building the hwacha subproject using Verilator name: Building the hwacha subproject using Verilator
command: .circleci/do-rtl-build.sh SUB_PROJECT=hwacha command: .circleci/do-rtl-build.sh SUB_PROJECT=hwacha

View File

@ -8,6 +8,10 @@ run () {
ssh -o "StrictHostKeyChecking no" -t $SERVER $1 ssh -o "StrictHostKeyChecking no" -t $SERVER $1
} }
run_script () {
ssh -o "StrictHostKeyChecking no" -t $SERVER 'bash -s' < $1
}
clean () { clean () {
# remove remote work dir # remove remote work dir
run "rm -rf $REMOTE_WORK_DIR" run "rm -rf $REMOTE_WORK_DIR"