master-thesis/netpfga/do-all-steps.sh

82 lines
1.8 KiB
Bash
Raw Normal View History

2019-06-03 19:31:58 +00:00
#!/bin/sh
set -e
set -x
2019-06-03 19:33:42 +00:00
echo "First source all variables and THEN run this script"
read something
2019-07-23 14:28:19 +00:00
SUFFIX=""
if [ $# -ge 1 ]; then
SUFFIX="-$1"
fi
LOG=~/master-thesis/netpfga/log/compile-$(date +%F-%H%M%S)$SUFFIX
2019-07-23 10:30:47 +00:00
(
2019-06-03 19:31:58 +00:00
# Step 1..3: create code
2019-07-21 12:37:31 +00:00
# Step 4:
2019-07-21 12:52:29 +00:00
date
2019-06-03 19:31:58 +00:00
cd $P4_PROJECT_DIR && make
# Step 5: sdnet simulation
2019-07-21 12:52:29 +00:00
date
cd $P4_PROJECT_DIR/nf_sume_sdnet_ip/SimpleSumeSwitch && ./vivado_sim.bash
2019-06-03 19:39:03 +00:00
expected_line=$(grep ^expected "$LOG" | sed -e 's/.*= <//' -e 's/.*= (//')
actual_line=$(grep ^actual "$LOG" | sed -e 's/.*= <//' -e 's/.*= (//')
2019-06-03 19:39:03 +00:00
# if [ -z "$expected_line" ]; then
# echo "Empty packet grep -- probably broken - aborting"
# exit 1
# fi
2019-06-03 19:56:45 +00:00
2019-06-03 19:39:03 +00:00
if [ "$expected_line" != "$actual_line" ]; then
echo packet mismatch
exit 1
fi
2019-06-03 19:31:58 +00:00
2019-06-10 09:20:11 +00:00
# Step 6: calls ${SUME_SDNET}/bin/gen_config_writes.py and generates SOMETHING
2019-07-21 12:52:29 +00:00
date
2019-06-03 19:31:58 +00:00
cd $P4_PROJECT_DIR && make config_writes
2019-06-10 09:20:11 +00:00
# Step 7: copies directory SDNET_OUT_DIR to TARGET and copies other dirs
2019-07-21 12:52:29 +00:00
date
2019-06-03 19:31:58 +00:00
cd $P4_PROJECT_DIR && make uninstall_sdnet && make install_sdnet
2019-06-10 09:20:11 +00:00
# Step 8: copies "config_writes.py" to the current dir - related to step 6
2019-07-21 12:52:29 +00:00
date
2019-06-03 19:31:58 +00:00
cd $NF_DESIGN_DIR/test/sim_switch_default && make
# -------- FIX config_writes.py here: add " pass" or overwrite whole script
# Step 9: Run the SUME simulation
2019-07-21 12:52:29 +00:00
date
2019-06-03 19:31:58 +00:00
cd $SUME_FOLDER && ./tools/scripts/nf_test.py sim --major switch --minor default
2019-06-06 20:30:31 +00:00
# Step 10: long compile step
2019-07-21 12:52:29 +00:00
date
2019-06-06 20:30:31 +00:00
if [ "$something" = no ]; then
:
else
cd $NF_DESIGN_DIR && make
fi
2019-06-03 19:31:58 +00:00
2019-06-06 20:28:46 +00:00
# Step 11: (nothing to be done)
2019-06-03 19:31:58 +00:00
# Step 12:
2019-07-21 12:52:29 +00:00
date
2019-06-03 19:31:58 +00:00
cd $NF_DESIGN_DIR/bitfiles
mv simple_sume_switch.bit ${P4_PROJECT_NAME}.bit
cp $P4_PROJECT_DIR/testdata/config_writes.sh ./
# Step 13:
2019-07-21 12:52:29 +00:00
date
2019-06-03 19:31:58 +00:00
cd $NF_DESIGN_DIR/bitfiles/
2019-06-12 17:06:18 +00:00
# some scripts are, some scripts aren't executable...
chmod u+x $(pwd -P)/program_switch.sh
2019-06-06 20:28:46 +00:00
sudo bash -c ". $HOME/master-thesis/netpfga/bashinit && $(pwd -P)/program_switch.sh"
2019-07-23 10:30:47 +00:00
) 2>&1 | tee "$LOG"