Create test environment

This commit is contained in:
xenia 2020-03-10 23:21:47 -04:00
parent 847d327d58
commit dc2e851655
5 changed files with 25 additions and 1 deletions

3
.gitignore vendored
View File

@ -4,4 +4,5 @@ target
*~
*\#
3700send
3700recv
3700recv
.netsim

4
.rustup/settings.toml Normal file
View File

@ -0,0 +1,4 @@
profile = "default"
version = "12"
[overrides]

View File

@ -25,3 +25,11 @@ t: test
rustup install nightly
rustup install stable
touch $@
.netsim:
mkdir $@
curl -Ss https://course.ccs.neu.edu/cs3700sp20/archive/tcp-sim.tgz | tar xzf - -C $@
sed -i '/.usr.bin.sudo/d' .netsim/netsim
netsim-shell: .netsim
./scripts/create-net-ns.sh

1
rust-toolchain Normal file
View File

@ -0,0 +1 @@
nightly

10
scripts/create-net-ns.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
cd $(dirname $DIR)
sudo unshare -n capsh --caps="cap_net_admin+eip cap_setpcap,cap_setuid,cap_setgid+ep" --keep=1 \
--user=$USER --addamb=cap_net_admin \
-- -c "export PATH=$PWD/.netsim:\$PATH; export HOME=$PWD; /usr/bin/ip link set lo up; netsim; \
tc qdisc show dev lo; /bin/bash --init-file <(echo unset HISTFILE)"
true