From 0b767a302b8d3c0e90fa180b08a53df1c9028a0e Mon Sep 17 00:00:00 2001 From: Raghav Gupta Date: Sat, 26 Feb 2022 08:01:43 +0000 Subject: [PATCH 01/16] setup VDE --- wlutil/launch.py | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/wlutil/launch.py b/wlutil/launch.py index b6995aaf..0d4f3b21 100644 --- a/wlutil/launch.py +++ b/wlutil/launch.py @@ -5,7 +5,7 @@ from . import wlutil jobProcs = [] - +vdeProc = None # Terminates jobs unless they have stopped running already def cleanUpSubProcesses(): @@ -14,12 +14,27 @@ def cleanUpSubProcesses(): if proc.poll() is None: log.info(f'cleaning up launched workload process {proc.pid}') proc.terminate() + cleanUpVDE() # Register clean up function with wlutil.py so it can be called by SIGINT handler wlutil.registerCleanUp(cleanUpSubProcesses) +# Start vde_plug server +def startVDE(): + log = logging.getLogger() + global vdeProc + log.info('Starting VDE') + vdeProc = sp.Popen(["vde_plug", "switch:///tmp/mysw", "cmd://slirpvde - --host=172.16.0.2/16 --dns=172.16.0.3"], stderr=sp.STDOUT) + +# Terminate vdeProc unless it has stopped running already +def cleanUpVDE(): + log = logging.getLogger() + if vdeProc and vdeProc.poll() is None: + log.info(f'cleaning up VDE process {vdeProc.pid}') + vdeProc.terminate() + # Kinda hacky (technically not guaranteed to give a free port, just very likely) def get_free_tcp_port(): tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM) @@ -58,7 +73,7 @@ def getSpikeCmd(config, nodisk=False): # Returns a command string to luanch the given config in qemu. Must be called with shell=True. def getQemuCmd(config, nodisk=False): - launch_port = get_free_tcp_port() + # launch_port = get_free_tcp_port() if nodisk: exe = str(wlutil.noDiskPath(config['bin'])) @@ -80,7 +95,8 @@ def getQemuCmd(config, nodisk=False): '-object', 'rng-random,filename=/dev/urandom,id=rng0', '-device', 'virtio-rng-device,rng=rng0', '-device', 'virtio-net-device,netdev=usernet', - '-netdev', 'user,id=usernet,hostfwd=tcp::' + launch_port + '-:22'] + #'-netdev', 'user,id=usernet,hostfwd=tcp::' + launch_port + '-:22'] + '-netdev', 'vde,id=vde0,sock=vde:///tmp/mysw'] if 'img' in config and not nodisk: cmd = cmd + ['-device', 'virtio-blk-device,drive=hd0', @@ -111,6 +127,9 @@ def launchWorkload(baseConfig, jobs=None, spike=False, silent=False): if not spike and baseConfig.get('qemu', True) is None: raise RuntimeError("This workload does not support qemu") + if not spike: + startVDE() + if jobs is None: configs = [baseConfig] else: @@ -160,6 +179,9 @@ def launchWorkload(baseConfig, jobs=None, spike=False, silent=False): cleanUpSubProcesses() raise + finally: + cleanUpVDE() + for config in configs: if 'outputs' in config: outputSpec = [wlutil.FileSpec(src=f, dst=runResDir) for f in config['outputs']] From 7f3727b08463c0dffe85aee90d3f76ab6bdf4a5e Mon Sep 17 00:00:00 2001 From: Raghav Gupta Date: Sat, 26 Feb 2022 11:23:52 +0000 Subject: [PATCH 02/16] Marshal Integration v1 works! --- .../br-base/overlay/etc/init.d/S40network | 55 ++++++++++--------- .../br-base/overlay/etc/network/interfaces | 6 ++ wlutil/launch.py | 19 ++++++- 3 files changed, 50 insertions(+), 30 deletions(-) diff --git a/boards/firechip/base-workloads/br-base/overlay/etc/init.d/S40network b/boards/firechip/base-workloads/br-base/overlay/etc/init.d/S40network index cff8f1d9..20563e7f 100755 --- a/boards/firechip/base-workloads/br-base/overlay/etc/init.d/S40network +++ b/boards/firechip/base-workloads/br-base/overlay/etc/init.d/S40network @@ -2,37 +2,38 @@ # # Start the network.... # - # Debian ifupdown needs the /run/network lock directory mkdir -p /run/network +resolvconf_file="/etc/resolv.conf" +rm -f $resolvconf_file +echo "nameserver 172.16.0.3" > $resolvconf_file + +ifname=eth0 +read _ addr _ _ <<< $(/sbin/ip link | /bin/grep -A 1 "$ifname" | /usr/bin/tail -1) +IFS=: read -r _ _ _ _ machigh maclow <<< $addr + case "$1" in - start) - printf "Starting network: " - /sbin/ifup -a - ifname=eth0 - if test -r "/sys/class/net/${ifname}/address" ; then - /sbin/ip link set dev "$ifname" up && - IFS=: read -r _ _ _ _ machigh maclow < "/sys/class/net/${ifname}/address" && - /sbin/ip addr add "172.16.$((16#$machigh)).$((16#$maclow))/16" dev "$ifname" - fi -# /sbin/ifup eth0 - [ $? = 0 ] && echo "OK" || echo "FAIL" - ;; - stop) - printf "Stopping network: " - /sbin/ifdown -a -# /sbin/ifdown eth0 - [ $? = 0 ] && echo "OK" || echo "FAIL" - ;; - restart|reload) - "$0" stop - "$0" start - ;; - *) - echo "Usage: $0 {start|stop|restart}" - exit 1 + start) + printf "Starting network: " + /bin/sed -i -e "1,/^address/{s/^address.*/address 172.16.$((16#$machigh)).$((16#$maclow))/;}" /etc/network/interfaces + sbin/ifup -a + [ $? = 0 ] && echo "OK" || echo "FAIL" + ;; + stop) + printf "Stopping network: " + /sbin/ifdown -a + /bin/sed -i -e "1,/^address/{s/^address.*/address firemarshal_ip_addr_uninitialized/;}" /etc/network/interfaces + [ $? = 0 ] && echo "OK" || echo "FAIL" + ;; + restart|reload) + "$0" stop + "$0" start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + esac exit $? - diff --git a/boards/firechip/base-workloads/br-base/overlay/etc/network/interfaces b/boards/firechip/base-workloads/br-base/overlay/etc/network/interfaces index fe584263..2cc53a88 100644 --- a/boards/firechip/base-workloads/br-base/overlay/etc/network/interfaces +++ b/boards/firechip/base-workloads/br-base/overlay/etc/network/interfaces @@ -2,3 +2,9 @@ auto lo iface lo inet loopback +auto eth0 +iface eth0 inet static +address firemarshal_ip_addr_uninitialized +netmask 255.255.0.0 +gateway 172.16.0.2 +dns-nameservers 172.16.0.3 diff --git a/wlutil/launch.py b/wlutil/launch.py index 0d4f3b21..54d8e9c3 100644 --- a/wlutil/launch.py +++ b/wlutil/launch.py @@ -72,7 +72,7 @@ def getSpikeCmd(config, nodisk=False): # Returns a command string to luanch the given config in qemu. Must be called with shell=True. -def getQemuCmd(config, nodisk=False): +def getQemuCmd(config, count, nodisk=False): # launch_port = get_free_tcp_port() if nodisk: @@ -85,6 +85,14 @@ def getQemuCmd(config, nodisk=False): else: qemuBin = 'qemu-system-riscv64' + # We should start static IP addresses at 172.16.0.4 => 4 = 1 (min val of count) + 3 + count += 3 + machigh = '00' + if count < 16: + maclow = '0' + hex(count)[2:] + else: + maclow = hex(count)[2:] + cmd = [qemuBin, '-nographic', '-bios none', @@ -94,7 +102,7 @@ def getQemuCmd(config, nodisk=False): '-kernel', exe, '-object', 'rng-random,filename=/dev/urandom,id=rng0', '-device', 'virtio-rng-device,rng=rng0', - '-device', 'virtio-net-device,netdev=usernet', + '-device', f'virtio-net-device,netdev=vde0,mac=00:12:6d:00:{machigh}:{maclow}', #'-netdev', 'user,id=usernet,hostfwd=tcp::' + launch_port + '-:22'] '-netdev', 'vde,id=vde0,sock=vde:///tmp/mysw'] @@ -140,8 +148,12 @@ def launchWorkload(baseConfig, jobs=None, spike=False, silent=False): screenIdentifiers = {} try: + count = 0; for config in configs: if config['launch']: + + count += 1 + runResDir = baseResDir / config['name'] uartLog = runResDir / "uartlog" os.makedirs(runResDir) @@ -149,7 +161,7 @@ def launchWorkload(baseConfig, jobs=None, spike=False, silent=False): if spike: cmd = getSpikeCmd(config, config['nodisk']) else: - cmd = getQemuCmd(config, config['nodisk']) + cmd = getQemuCmd(config, count, config['nodisk']) log.info(f"\nLaunching job {config['name']}") log.info(f'Running: {cmd}') @@ -174,6 +186,7 @@ def launchWorkload(baseConfig, jobs=None, spike=False, silent=False): for proc in jobProcs: proc.wait() + cleanUpVDE() except Exception: cleanUpSubProcesses() From b7ccd931f8d1badf2061449d0061bd70079e4d9e Mon Sep 17 00:00:00 2001 From: Raghav Gupta Date: Tue, 1 Mar 2022 09:31:44 +0000 Subject: [PATCH 03/16] Internet test + Network test needs better test harness --- test/internet.yaml | 9 +++++++++ test/internet/refOutput/internet/uartlog | 1 + test/network.yaml | 23 ++++++++++++++++++++++ test/network/overlay/root/client | Bin 0 -> 12296 bytes test/network/overlay/root/server | Bin 0 -> 12456 bytes test/network/refOutput/network-j0/uartlog | 3 +++ test/network/refOutput/network-j1/uartlog | 1 + test/network/refOutput/network-j2/uartlog | 1 + 8 files changed, 38 insertions(+) create mode 100644 test/internet.yaml create mode 100644 test/internet/refOutput/internet/uartlog create mode 100644 test/network.yaml create mode 100755 test/network/overlay/root/client create mode 100755 test/network/overlay/root/server create mode 100644 test/network/refOutput/network-j0/uartlog create mode 100644 test/network/refOutput/network-j1/uartlog create mode 100644 test/network/refOutput/network-j2/uartlog diff --git a/test/internet.yaml b/test/internet.yaml new file mode 100644 index 00000000..94ee6af2 --- /dev/null +++ b/test/internet.yaml @@ -0,0 +1,9 @@ +{ + "name" : "internet", + "base" : "br-base.json", + "command" : "wget -S fires.im", + "testing" : { + "refDir" : "refOutput", + "strip" : true + } +} diff --git a/test/internet/refOutput/internet/uartlog b/test/internet/refOutput/internet/uartlog new file mode 100644 index 00000000..12f5268f --- /dev/null +++ b/test/internet/refOutput/internet/uartlog @@ -0,0 +1 @@ + Location: https://fires.im/ diff --git a/test/network.yaml b/test/network.yaml new file mode 100644 index 00000000..a77a9652 --- /dev/null +++ b/test/network.yaml @@ -0,0 +1,23 @@ +{ + "name" : "network", + "base" : "br-base.json", + "overlay": "overlay", + "testing" : { + "refDir" : "refOutput", + "strip" : true + }, + "jobs" : [ + { + "name" : "j0", + "command" : "/root/server 172.16.0.4 2", + }, + { + "name" : "j1", + "command" : "sleep 3; /root/client 172.16.0.4" + }, + { + "name" : "j2", + "command" : "sleep 5; /root/client 172.16.0.4" + } + ] +} diff --git a/test/network/overlay/root/client b/test/network/overlay/root/client new file mode 100755 index 0000000000000000000000000000000000000000..2bcc067d6d15e0775a98ca664436db708e2b7642 GIT binary patch literal 12296 zcmeHNeQ;FQb-!=lN~aZ(;i7hZ6tJRm4@Kp(%fSEp4Z=a+!tGDa@ zAjqLb5-dWlLqrruG(!f$AGJfLQ|!9q3=lVIl9{;ENsV16Zksj)JHeeem0Hs{AAow! zz4xr%ds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!T87wl-ml^(MZq&h|Q71DDGT zg8H_``n&42KvQ!|D_X5dS?LA4Lx=UkUWVXhzXO6Ef|7)v!M_5K$wpl34#vWG5_kGk z;{AU5(9XXEa7fdeeg~-0fJnr_anh4F@y`q-mJY)ZHt`P!tZxt;Jp5Aw2ZG-uH~{OT z1P6pQG#p6!YX=9)zf^D_ns(P64Wh^J!v_ZuzoO_#I3Vjo2?xadMsJT9?10!zT5&g} zcvB>pKL(zyzdq1XX$HHPAADwichKl&{%~&$gss?2S`>KwWJKaIM@9o0c)3A;B5E?f zsqcelGR{YnU+)&vraKH=lw*E}%gOv#-B0Gf>iP1bgFTTD6c-1jhNTlaiuqwe_rS~p z7QG|Y1)g#+)&;X)WFxW8IHiLf9Z7u;Pv%7Fk^ifMWBZ|M6x9|?+>_DO4aa7)Vr z>8XL-=kRWaEzx37_yQ) zy+0ch1s(;OJ;?3%Eg-_RS=xT`(>7s&5XhA!`>7m?(eK80Uz8_*Zl93%p%MtP{T9mL zTM;}5GZqj4`F&3c`3u5eEFX5y8TH3^7RVyl)Ba(*XsE4Hh4CDXf#UliZI>St`|226 zE@G$?{b1!RTPcn4UihOt)t~&$alDX(@Et2kKdJu+*bfQ2Jo%;cooER$ikQY7!T3VP zE>HgJLGcmKQeqUbT>cTju`Q^Y{TP`T9quYfGFkbK(T5Da5Lvj>u=_@97i zm#6din2@J(NC(ML{vsq0qw>k$JSPNYerkV`{~06@t0q9iBwsAyBv0{sK&P~w^^z#R z&kjObuFp7Nv&pxMf=g&(2t6|IIJf+c^5trxhB{X0AX_Q+U!(j(;;N;M7$tc!3CU6wIq4E^tPniH;6;#L q4u7(r_77a Date: Tue, 1 Mar 2022 19:05:26 +0000 Subject: [PATCH 04/16] network test works, all jobs launch concurrently during testing --- test/network/refOutput/network-j0/uartlog | 1 + wlutil/test.py | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/network/refOutput/network-j0/uartlog b/test/network/refOutput/network-j0/uartlog index b2551c72..337b59db 100644 --- a/test/network/refOutput/network-j0/uartlog +++ b/test/network/refOutput/network-j0/uartlog @@ -1,3 +1,4 @@ Success : 1 : 172.16.0.5 Success : 2 : 172.16.0.6 + Final Success diff --git a/wlutil/test.py b/wlutil/test.py index dee18282..6fd873a2 100755 --- a/wlutil/test.py +++ b/wlutil/test.py @@ -147,10 +147,12 @@ def testWorkload(cfgName, cfgs, verbose=False, spike=False, cmp_only=None): # Run every job (or just the workload itself if no jobs) if 'jobs' in cfg: + jNames = '' for jName in cfg['jobs'].keys(): - log.info("Running job " + jName) - with timeout(testCfg['runTimeout'], 'launch job' + jName): - wllaunch.launchWorkload(cfg, jobs=[jName], spike=spike, silent=not verbose) + jNames += jName + ' ' + log.info("Running job " + jNames) + with timeout(testCfg['runTimeout'], 'launch jobs' + jNames): + wllaunch.launchWorkload(cfg, jobs=cfg['jobs'], spike=spike, silent=not verbose) else: log.info("Running workload") with timeout(testCfg['runTimeout'], 'launch'): From c5de29e0a33217b8aed7f29ee01f0e585d5d2fb7 Mon Sep 17 00:00:00 2001 From: Raghav Gupta Date: Fri, 25 Mar 2022 22:31:14 +0000 Subject: [PATCH 05/16] VDE Integration with vde-2 complete --- boards/default/distros/fedora/fedora.py | 2 ++ .../etc/systemd/system/firesim.service | 11 +++++++ .../overlay/etc/firesim/ifcfg-static | 2 ++ .../overlay/etc/firesim/network-static | 3 ++ .../etc/firesim/start-firesim-network.sh | 2 ++ scripts/fullTest.py | 5 +++- test/fed-nw-internet.yaml | 27 ++++++++++++++++++ test/fed-nw-internet/overlay/root/client | Bin 0 -> 12456 bytes test/fed-nw-internet/overlay/root/server | Bin 0 -> 12192 bytes .../overlay/root/test-client-1.sh | 12 ++++++++ .../overlay/root/test-client-2-copy.sh | 15 ++++++++++ .../overlay/root/test-client-2.sh | 12 ++++++++ .../overlay/root/test-server.sh | 12 ++++++++ .../refOutput/fed-nw-internet-j0/uartlog | 1 + .../refOutput/fed-nw-internet-j1/uartlog | 1 + .../refOutput/fed-nw-internet-j2/uartlog | 1 + .../refOutput/fed-nw-internet-j3/uartlog | 1 + test/internet.yaml | 2 +- test/internet/refOutput/internet/uartlog | 2 +- test/network.yaml | 10 +++---- test/network/overlay/root/client | Bin 12296 -> 12456 bytes test/network/overlay/root/server | Bin 12456 -> 12192 bytes test/network/overlay/root/test-client-1.sh | 12 ++++++++ test/network/overlay/root/test-client-2.sh | 12 ++++++++ test/network/overlay/root/test-server.sh | 12 ++++++++ test/network/refOutput/network-j0/uartlog | 5 +--- test/network/refOutput/network-j1/uartlog | 2 +- test/network/refOutput/network-j2/uartlog | 2 +- test/post-bin/create-file.sh | 3 +- test/post-bin/refOutputBase/post-bin/uartlog | 3 +- .../refOutputJobs/post-bin-jobs-j0/uartlog | 3 +- .../refOutputJobs/post-bin-jobs-j1/uartlog | 3 +- wlutil/build.py | 2 +- wlutil/launch.py | 26 ++++++++++------- 34 files changed, 172 insertions(+), 34 deletions(-) create mode 100644 boards/default/distros/fedora/overlay/etc/systemd/system/firesim.service create mode 100644 boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/network-static create mode 100644 test/fed-nw-internet.yaml create mode 100755 test/fed-nw-internet/overlay/root/client create mode 100755 test/fed-nw-internet/overlay/root/server create mode 100755 test/fed-nw-internet/overlay/root/test-client-1.sh create mode 100755 test/fed-nw-internet/overlay/root/test-client-2-copy.sh create mode 100755 test/fed-nw-internet/overlay/root/test-client-2.sh create mode 100755 test/fed-nw-internet/overlay/root/test-server.sh create mode 100644 test/fed-nw-internet/refOutput/fed-nw-internet-j0/uartlog create mode 100644 test/fed-nw-internet/refOutput/fed-nw-internet-j1/uartlog create mode 100644 test/fed-nw-internet/refOutput/fed-nw-internet-j2/uartlog create mode 100644 test/fed-nw-internet/refOutput/fed-nw-internet-j3/uartlog create mode 100755 test/network/overlay/root/test-client-1.sh create mode 100755 test/network/overlay/root/test-client-2.sh create mode 100755 test/network/overlay/root/test-server.sh diff --git a/boards/default/distros/fedora/fedora.py b/boards/default/distros/fedora/fedora.py index d8491012..a40035c7 100644 --- a/boards/default/distros/fedora/fedora.py +++ b/boards/default/distros/fedora/fedora.py @@ -7,6 +7,8 @@ serviceTemplate = """[Unit] Requires=multi-user.target After=multi-user.target +Requires=network-online.target +After=network-online.target Before=firesim.target Wants=firesim.target diff --git a/boards/default/distros/fedora/overlay/etc/systemd/system/firesim.service b/boards/default/distros/fedora/overlay/etc/systemd/system/firesim.service new file mode 100644 index 00000000..6406150d --- /dev/null +++ b/boards/default/distros/fedora/overlay/etc/systemd/system/firesim.service @@ -0,0 +1,11 @@ +[Unit] +Requires=multi-user.target +After=multi-user.target +Requires=network-online.target +After=network-online.target +Before=firesim.target +Wants=firesim.target + +[Service] +ExecStart=/etc/firesim/firesim.sh +StandardOutput=journal+console \ No newline at end of file diff --git a/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/ifcfg-static b/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/ifcfg-static index a35932cd..3692b9c9 100644 --- a/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/ifcfg-static +++ b/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/ifcfg-static @@ -2,3 +2,5 @@ DEVICE=eth0 BOOTPROTO=static ONBOOT=on PREFIX=16 +PEERDNS=yes +DNS1=172.16.0.3 diff --git a/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/network-static b/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/network-static new file mode 100644 index 00000000..6860e95b --- /dev/null +++ b/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/network-static @@ -0,0 +1,3 @@ +NETWORKING=yes +NETWORKING_IPV6=no +GATEWAY=172.16.0.2 diff --git a/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/start-firesim-network.sh b/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/start-firesim-network.sh index 39d6c4cf..d6a5ba47 100755 --- a/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/start-firesim-network.sh +++ b/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/start-firesim-network.sh @@ -12,6 +12,8 @@ case "$macpref" in maclow=$(echo $mac | cut -c 16-17 -) cp /etc/firesim/ifcfg-static /etc/sysconfig/network-scripts/ifcfg-eth0 echo IPADDR=172.16.$((16#$machigh)).$((16#$maclow)) >> /etc/sysconfig/network-scripts/ifcfg-eth0 + echo default via 172.16.0.2 dev eth0 > /etc/sysconfig/network-scripts/route-eth0 + cp /etc/firesim/network-static /etc/sysconfig/network ;; "52:54:00") echo "this looks like not FireSim. exiting" diff --git a/scripts/fullTest.py b/scripts/fullTest.py index f7554491..a2de55f3 100755 --- a/scripts/fullTest.py +++ b/scripts/fullTest.py @@ -69,7 +69,10 @@ 'qemu', 'run', 'simArgs', - 'noDrivers' + 'noDrivers', + 'internet', + 'network', + 'fed-nw-internet' ], # This tests both no-disk and spike. In theory, most (maybe all?) tests diff --git a/test/fed-nw-internet.yaml b/test/fed-nw-internet.yaml new file mode 100644 index 00000000..7acc0a6f --- /dev/null +++ b/test/fed-nw-internet.yaml @@ -0,0 +1,27 @@ +{ + "name" : "fed-nw-internet", + "base" : "fedora-base.json", + "overlay": "overlay", + "testing" : { + "refDir" : "refOutput", + "strip" : true + }, + "jobs" : [ + { + "name" : "j0", + "command" : "timeout 75 /root/test-server.sh" + }, + { + "name" : "j1", + "command" : "/root/test-client-1.sh" + }, + { + "name" : "j2", + "command" : "/root/test-client-2.sh" + }, + { + "name" : "j3", + "command" : 'yum install -y wget && wget fires.im && echo "Success : yum + wget"' + } + ] +} diff --git a/test/fed-nw-internet/overlay/root/client b/test/fed-nw-internet/overlay/root/client new file mode 100755 index 0000000000000000000000000000000000000000..7879b641f2bf7efb1a5e789b5e4564965ea8da70 GIT binary patch literal 12456 zcmd5?3vg7|c|LdV>Mf)d3kYf_zF0O0$65(YY=L=5D}<~>2n@#YgZ8qzdnGNbcGtTr zf^4Tq!m_|^2$Z&)0G>X`VE7}M`R z_x!7Sua?A}Os73Nd(S!F|2Y47-t(Vx_jLBG4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RYutr<}< zuA>oLquM6Xe1Vf>JnfyW!Z$rWg5)55ttevVhm=6A*2kM!!SJs z88e3xR1OUeCXHi6Va!ZrKI4dhR-qz9wzTa1w{zUr;1UVT4o|edr|;%!1x}fBb!PlK zA~<@>>Qfv*-=+CUQRMWTA^3|>!1GM1pW=ma0rUw$l)(h2nLLpl{Ql_I@J@sDDXw@+ z02C<7`oau*01EgHhx94_XjLrN-lmAo?^qvVx zcv|J$Kc4O5Jz@J`qB!a*0n!cQeiIYrPe9qBFP?i>aZo`@(v4Xp_f-^m_9R?UpTsCG zYY;E$0$ghOLj6a`NhsL$DSo5xBdbYJ1uXWs*l|vm&q(}M7fZ+#+q)+?wwVzS{HPFSbCVh%S z>3i1e!eJT?R4?`aUxO}+kbZVwE(Fd1&z?x1@;8BL*QfpL8KF=0kPXr!`lnDpjOwSj z?0KOm%TxQ4{yR`WteF6jlYW(ilRo7)fKO$+=v7hwxE+MDd_VJm<55O!qQ z+bigI;ADriS5lBjhT)-%q28RBIA8cr>R+>h{`bX^LllkKlH4Cw{FmGQ4dQ5`g*sN) zAYUohR;d4wIFjfmK}nxnLbh~^oOKl+tdO1;>)4%8-U5H}pPnD^t|2@2pqNd&>#X8? Xl5xo$h~e_<*Ke})F%GsTiDdr{v#+mM literal 0 HcmV?d00001 diff --git a/test/fed-nw-internet/overlay/root/test-client-1.sh b/test/fed-nw-internet/overlay/root/test-client-1.sh new file mode 100755 index 00000000..cc0ee743 --- /dev/null +++ b/test/fed-nw-internet/overlay/root/test-client-1.sh @@ -0,0 +1,12 @@ +#/bin/bash +ip_read=`ip -f inet addr show eth0 | grep -Po 'inet \K[\d.]+'` +if [ "$ip_read" = "172.16.0.5" ]; then + /root/client 172.16.0.4 + if [ "$?" -eq "0" ]; then + echo 'Success : ip + client' + else + echo 'Failed : client' + fi +else + echo 'Failed : ip' +fi diff --git a/test/fed-nw-internet/overlay/root/test-client-2-copy.sh b/test/fed-nw-internet/overlay/root/test-client-2-copy.sh new file mode 100755 index 00000000..7ae0b4c1 --- /dev/null +++ b/test/fed-nw-internet/overlay/root/test-client-2-copy.sh @@ -0,0 +1,15 @@ +#/bin/bash +ip_read=`ip -f inet addr show` +str="read ip" +echo $str +echo $ip_read +if [ "$ip_read" = "172.16.0.6" ]; then + /root/client 172.16.0.4 + if [ "$?" -eq "0" ]; then + echo 'Success : ip + client' + else + echo 'Failed : client' + fi +else + echo 'Failed : ip' +fi diff --git a/test/fed-nw-internet/overlay/root/test-client-2.sh b/test/fed-nw-internet/overlay/root/test-client-2.sh new file mode 100755 index 00000000..d3aa7b63 --- /dev/null +++ b/test/fed-nw-internet/overlay/root/test-client-2.sh @@ -0,0 +1,12 @@ +#/bin/bash +ip_read=`ip -f inet addr show eth0 | grep -Po 'inet \K[\d.]+'` +if [ "$ip_read" = "172.16.0.6" ]; then + /root/client 172.16.0.4 + if [ "$?" -eq "0" ]; then + echo 'Success : ip + client' + else + echo 'Failed : client' + fi +else + echo 'Failed : ip' +fi diff --git a/test/fed-nw-internet/overlay/root/test-server.sh b/test/fed-nw-internet/overlay/root/test-server.sh new file mode 100755 index 00000000..5536978d --- /dev/null +++ b/test/fed-nw-internet/overlay/root/test-server.sh @@ -0,0 +1,12 @@ +#/bin/bash +ip_read=`ip -f inet addr show eth0 | grep -Po 'inet \K[\d.]+'` +if [ "$ip_read" = "172.16.0.4" ]; then + /root/server 2 + if [ "$?" -eq "0" ]; then + echo 'Success : ip + server' + else + echo 'Failed : server' + fi +else + echo 'Failed : ip' +fi diff --git a/test/fed-nw-internet/refOutput/fed-nw-internet-j0/uartlog b/test/fed-nw-internet/refOutput/fed-nw-internet-j0/uartlog new file mode 100644 index 00000000..72365904 --- /dev/null +++ b/test/fed-nw-internet/refOutput/fed-nw-internet-j0/uartlog @@ -0,0 +1 @@ +Success : ip + server diff --git a/test/fed-nw-internet/refOutput/fed-nw-internet-j1/uartlog b/test/fed-nw-internet/refOutput/fed-nw-internet-j1/uartlog new file mode 100644 index 00000000..556bfc7e --- /dev/null +++ b/test/fed-nw-internet/refOutput/fed-nw-internet-j1/uartlog @@ -0,0 +1 @@ +Success : ip + client diff --git a/test/fed-nw-internet/refOutput/fed-nw-internet-j2/uartlog b/test/fed-nw-internet/refOutput/fed-nw-internet-j2/uartlog new file mode 100644 index 00000000..556bfc7e --- /dev/null +++ b/test/fed-nw-internet/refOutput/fed-nw-internet-j2/uartlog @@ -0,0 +1 @@ +Success : ip + client diff --git a/test/fed-nw-internet/refOutput/fed-nw-internet-j3/uartlog b/test/fed-nw-internet/refOutput/fed-nw-internet-j3/uartlog new file mode 100644 index 00000000..dfe27559 --- /dev/null +++ b/test/fed-nw-internet/refOutput/fed-nw-internet-j3/uartlog @@ -0,0 +1 @@ +Success : yum + wget diff --git a/test/internet.yaml b/test/internet.yaml index 94ee6af2..7b36740b 100644 --- a/test/internet.yaml +++ b/test/internet.yaml @@ -1,7 +1,7 @@ { "name" : "internet", "base" : "br-base.json", - "command" : "wget -S fires.im", + "command" : 'wget -S fires.im && echo "Success : wget"', "testing" : { "refDir" : "refOutput", "strip" : true diff --git a/test/internet/refOutput/internet/uartlog b/test/internet/refOutput/internet/uartlog index 12f5268f..8ed09fc2 100644 --- a/test/internet/refOutput/internet/uartlog +++ b/test/internet/refOutput/internet/uartlog @@ -1 +1 @@ - Location: https://fires.im/ +Success : wget diff --git a/test/network.yaml b/test/network.yaml index a77a9652..6e3c1483 100644 --- a/test/network.yaml +++ b/test/network.yaml @@ -8,16 +8,16 @@ }, "jobs" : [ { - "name" : "j0", - "command" : "/root/server 172.16.0.4 2", + "name" : "j0", + "command" : "timeout 75 /root/test-server.sh" }, { - "name" : "j1", - "command" : "sleep 3; /root/client 172.16.0.4" + "name" : "j1", + "command" : "/root/test-client-1.sh" }, { "name" : "j2", - "command" : "sleep 5; /root/client 172.16.0.4" + "command" : "/root/test-client-2.sh" } ] } diff --git a/test/network/overlay/root/client b/test/network/overlay/root/client index 2bcc067d6d15e0775a98ca664436db708e2b7642..7879b641f2bf7efb1a5e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8CTlG+ZcqV$j%_dX5 z^xuU8P6saRlTIn8lS|OHp^g>5HAdiulg`L}r?-YrPk$lXC8VFzy}7!DbNyb>D@i{*nD?emPUB&yV72ja+7Gu17P@G{UtL}I zwe_o3H!SijTEa5@RA|UP|0MyAxsMBdP*do&sTYEi<+!+y5mm2&D-0cjQAE|tVvuJ1 zNJl_e;I*kIRXw{y3ZZ6!*QB0P^g38jZd31y!%XNBjH0TKtrj1)MEhuBRF4FZraEGGT3JsdQem=;NGn%_8QgQGYB2U zON`1=B)GfJ6;}x(a39Mts3@rte9(bq7|vmN5$> ${1}.txt -echo $@ >> ${1}.txt +echo "From create-file.sh script: $@" >> ${1}.txt diff --git a/test/post-bin/refOutputBase/post-bin/uartlog b/test/post-bin/refOutputBase/post-bin/uartlog index 3e9f7802..abe3014d 100644 --- a/test/post-bin/refOutputBase/post-bin/uartlog +++ b/test/post-bin/refOutputBase/post-bin/uartlog @@ -1,2 +1 @@ -From create-file.sh script: -base +From create-file.sh script: base diff --git a/test/post-bin/refOutputJobs/post-bin-jobs-j0/uartlog b/test/post-bin/refOutputJobs/post-bin-jobs-j0/uartlog index 8f51dc10..bf0a8bb9 100644 --- a/test/post-bin/refOutputJobs/post-bin-jobs-j0/uartlog +++ b/test/post-bin/refOutputJobs/post-bin-jobs-j0/uartlog @@ -1,2 +1 @@ -From create-file.sh script: -job0 +From create-file.sh script: job0 diff --git a/test/post-bin/refOutputJobs/post-bin-jobs-j1/uartlog b/test/post-bin/refOutputJobs/post-bin-jobs-j1/uartlog index 4e12e956..c070dac9 100644 --- a/test/post-bin/refOutputJobs/post-bin-jobs-j1/uartlog +++ b/test/post-bin/refOutputJobs/post-bin-jobs-j1/uartlog @@ -1,2 +1 @@ -From create-file.sh script: -job1 +From create-file.sh script: job1 diff --git a/wlutil/build.py b/wlutil/build.py index df23724b..5b3ff0a0 100644 --- a/wlutil/build.py +++ b/wlutil/build.py @@ -580,7 +580,7 @@ def makeImage(config): init_overlay = config['builder'].generateBootScriptOverlay( str(config['guest-init'].path), config['guest-init'].args) wlutil.applyOverlay(config['img'], init_overlay) - wlutil.run(wllaunch.getQemuCmd(config), shell=True, level=logging.DEBUG) + wllaunch.launchWorkload(config, jobs=None, spike=False, silent=True, captureOutput=False) # Clear the init script run_overlay = config['builder'].generateBootScriptOverlay(None, None) diff --git a/wlutil/launch.py b/wlutil/launch.py index 54d8e9c3..915e32e7 100644 --- a/wlutil/launch.py +++ b/wlutil/launch.py @@ -72,7 +72,7 @@ def getSpikeCmd(config, nodisk=False): # Returns a command string to luanch the given config in qemu. Must be called with shell=True. -def getQemuCmd(config, count, nodisk=False): +def getQemuCmd(config, count=1, nodisk=False): # launch_port = get_free_tcp_port() if nodisk: @@ -113,7 +113,7 @@ def getQemuCmd(config, count, nodisk=False): return " ".join(cmd) + " " + config.get('qemu-args', '') -def launchWorkload(baseConfig, jobs=None, spike=False, silent=False): +def launchWorkload(baseConfig, jobs=None, spike=False, silent=False, captureOutput=True): """Launches the specified workload in functional simulation. cfgName: unique name of the workload in the cfgs @@ -154,10 +154,6 @@ def launchWorkload(baseConfig, jobs=None, spike=False, silent=False): count += 1 - runResDir = baseResDir / config['name'] - uartLog = runResDir / "uartlog" - os.makedirs(runResDir) - if spike: cmd = getSpikeCmd(config, config['nodisk']) else: @@ -165,10 +161,17 @@ def launchWorkload(baseConfig, jobs=None, spike=False, silent=False): log.info(f"\nLaunching job {config['name']}") log.info(f'Running: {cmd}') - if silent: - log.info("For live output see: " + str(uartLog)) - scriptCmd = f'script -f -c "{cmd}" {uartLog}' + if captureOutput: + runResDir = baseResDir / config['name'] + uartLog = runResDir / "uartlog" + os.makedirs(runResDir) + scriptCmd = f'script -f -c "{cmd}" {uartLog}' + else: + scriptCmd = cmd + + if silent and captureOutput: + log.info("For live output see: " + str(uartLog)) if not silent and len(configs) == 1: jobProcs.append(sp.Popen(["screen", "-S", config['name'], "-m", "bash", "-c", scriptCmd], stderr=sp.STDOUT)) @@ -196,11 +199,12 @@ def launchWorkload(baseConfig, jobs=None, spike=False, silent=False): cleanUpVDE() for config in configs: - if 'outputs' in config: + if 'outputs' in config and captureOutput: + runResDir = baseResDir / config['name'] outputSpec = [wlutil.FileSpec(src=f, dst=runResDir) for f in config['outputs']] wlutil.copyImgFiles(config['img'], outputSpec, direction='out') - if 'post_run_hook' in baseConfig: + if 'post_run_hook' in baseConfig and captureOutput: prhCmd = [baseConfig['post_run_hook'].path] + baseConfig['post_run_hook'].args + [baseResDir] log.info("Running post_run_hook script: " + ' '.join([str(x) for x in prhCmd])) try: From 3eeec62f45499a4a4dcd27af3923da5dd35ab958 Mon Sep 17 00:00:00 2001 From: Raghav Gupta Date: Fri, 25 Mar 2022 23:54:40 +0000 Subject: [PATCH 06/16] VDE Integration with vdeplug4 complete --- wlutil/launch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wlutil/launch.py b/wlutil/launch.py index 915e32e7..176e7342 100644 --- a/wlutil/launch.py +++ b/wlutil/launch.py @@ -25,7 +25,7 @@ def startVDE(): log = logging.getLogger() global vdeProc log.info('Starting VDE') - vdeProc = sp.Popen(["vde_plug", "switch:///tmp/mysw", "cmd://slirpvde - --host=172.16.0.2/16 --dns=172.16.0.3"], stderr=sp.STDOUT) + vdeProc = sp.Popen(["vde_plug", "vxvde://", "slirp:///host=172.16.0.2"], stderr=sp.STDOUT) # Terminate vdeProc unless it has stopped running already @@ -104,7 +104,7 @@ def getQemuCmd(config, count=1, nodisk=False): '-device', 'virtio-rng-device,rng=rng0', '-device', f'virtio-net-device,netdev=vde0,mac=00:12:6d:00:{machigh}:{maclow}', #'-netdev', 'user,id=usernet,hostfwd=tcp::' + launch_port + '-:22'] - '-netdev', 'vde,id=vde0,sock=vde:///tmp/mysw'] + '-netdev', 'vde,id=vde0,sock=vxvde://'] if 'img' in config and not nodisk: cmd = cmd + ['-device', 'virtio-blk-device,drive=hd0', From 1233cd9f069ea383837d2b30fa126e1896cfbfb0 Mon Sep 17 00:00:00 2001 From: Raghav Gupta Date: Fri, 8 Apr 2022 20:36:22 +0000 Subject: [PATCH 07/16] PR changes --- .../br-base/overlay/etc/init.d/S40network | 9 +- .../br-base/overlay/etc/network/interfaces | 6 +- .../overlay/etc/firesim/ifcfg-static | 2 +- .../overlay/etc/firesim/network-static | 2 +- .../etc/firesim/start-firesim-network.sh | 2 +- test/fed-nw-internet.yaml | 1 + test/fed-nw-internet/client.c | 91 ++++++++++++++++++ test/fed-nw-internet/host-init.sh | 3 + test/fed-nw-internet/overlay/root/client | Bin 12456 -> 0 bytes test/fed-nw-internet/overlay/root/server | Bin 12192 -> 0 bytes .../overlay/root/test-client-1.sh | 6 +- .../overlay/root/test-client-2-copy.sh | 15 --- .../overlay/root/test-client-2.sh | 6 +- .../overlay/root/test-server.sh | 4 +- test/fed-nw-internet/server.c | 56 +++++++++++ test/network.yaml | 3 +- test/network/client.c | 91 ++++++++++++++++++ test/network/host-init.sh | 3 + test/network/overlay/root/client | Bin 12456 -> 0 bytes test/network/overlay/root/server | Bin 12192 -> 0 bytes test/network/overlay/root/test-client-1.sh | 6 +- test/network/overlay/root/test-client-2.sh | 6 +- test/network/overlay/root/test-server.sh | 4 +- test/network/server.c | 56 +++++++++++ wlutil/launch.py | 16 +-- 25 files changed, 346 insertions(+), 42 deletions(-) create mode 100644 test/fed-nw-internet/client.c create mode 100755 test/fed-nw-internet/host-init.sh delete mode 100755 test/fed-nw-internet/overlay/root/client delete mode 100755 test/fed-nw-internet/overlay/root/server delete mode 100755 test/fed-nw-internet/overlay/root/test-client-2-copy.sh create mode 100644 test/fed-nw-internet/server.c create mode 100644 test/network/client.c create mode 100755 test/network/host-init.sh delete mode 100755 test/network/overlay/root/client delete mode 100755 test/network/overlay/root/server create mode 100644 test/network/server.c diff --git a/boards/firechip/base-workloads/br-base/overlay/etc/init.d/S40network b/boards/firechip/base-workloads/br-base/overlay/etc/init.d/S40network index 20563e7f..7df73fc0 100755 --- a/boards/firechip/base-workloads/br-base/overlay/etc/init.d/S40network +++ b/boards/firechip/base-workloads/br-base/overlay/etc/init.d/S40network @@ -5,24 +5,29 @@ # Debian ifupdown needs the /run/network lock directory mkdir -p /run/network +# Write DNS to /etc/resolv.conf resolvconf_file="/etc/resolv.conf" rm -f $resolvconf_file -echo "nameserver 172.16.0.3" > $resolvconf_file +echo "nameserver 172.16.1.3" > $resolvconf_file +# mac address of NIC at eth0 decides ip address we'd like to use ifname=eth0 read _ addr _ _ <<< $(/sbin/ip link | /bin/grep -A 1 "$ifname" | /usr/bin/tail -1) +# Extract the bottom 2 bytes of mac addr IFS=: read -r _ _ _ _ machigh maclow <<< $addr case "$1" in start) printf "Starting network: " - /bin/sed -i -e "1,/^address/{s/^address.*/address 172.16.$((16#$machigh)).$((16#$maclow))/;}" /etc/network/interfaces + # Use sed to substitute target address 172.16.machigh.maclow for the first interface (eth0) in /etc/network/interfaces + /bin/sed -i -e "1,/^address/{s/^address.*/address 172.16.$((16#$machigh)).$((16#$maclow))/;}" /etc/network/interfaces sbin/ifup -a [ $? = 0 ] && echo "OK" || echo "FAIL" ;; stop) printf "Stopping network: " /sbin/ifdown -a + # Not functionalyl necessary, substitute "firemarshal_ip_addr_uninitialized" for eth0 in /etc/network/interfaces to make the file understandable for users /bin/sed -i -e "1,/^address/{s/^address.*/address firemarshal_ip_addr_uninitialized/;}" /etc/network/interfaces [ $? = 0 ] && echo "OK" || echo "FAIL" ;; diff --git a/boards/firechip/base-workloads/br-base/overlay/etc/network/interfaces b/boards/firechip/base-workloads/br-base/overlay/etc/network/interfaces index 2cc53a88..26ecc2ed 100644 --- a/boards/firechip/base-workloads/br-base/overlay/etc/network/interfaces +++ b/boards/firechip/base-workloads/br-base/overlay/etc/network/interfaces @@ -1,4 +1,4 @@ - +# marshal requires eth0 to be the first interface in this file, please add other interfaces below it auto lo iface lo inet loopback @@ -6,5 +6,5 @@ auto eth0 iface eth0 inet static address firemarshal_ip_addr_uninitialized netmask 255.255.0.0 -gateway 172.16.0.2 -dns-nameservers 172.16.0.3 +gateway 172.16.0.1 +dns-nameservers 172.16.1.3 diff --git a/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/ifcfg-static b/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/ifcfg-static index 3692b9c9..831d7b26 100644 --- a/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/ifcfg-static +++ b/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/ifcfg-static @@ -3,4 +3,4 @@ BOOTPROTO=static ONBOOT=on PREFIX=16 PEERDNS=yes -DNS1=172.16.0.3 +DNS1=172.16.1.3 diff --git a/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/network-static b/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/network-static index 6860e95b..46ef1742 100644 --- a/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/network-static +++ b/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/network-static @@ -1,3 +1,3 @@ NETWORKING=yes NETWORKING_IPV6=no -GATEWAY=172.16.0.2 +GATEWAY=172.16.0.1 diff --git a/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/start-firesim-network.sh b/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/start-firesim-network.sh index d6a5ba47..5c4151c6 100755 --- a/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/start-firesim-network.sh +++ b/boards/firechip/base-workloads/fedora-base/overlay/etc/firesim/start-firesim-network.sh @@ -12,7 +12,7 @@ case "$macpref" in maclow=$(echo $mac | cut -c 16-17 -) cp /etc/firesim/ifcfg-static /etc/sysconfig/network-scripts/ifcfg-eth0 echo IPADDR=172.16.$((16#$machigh)).$((16#$maclow)) >> /etc/sysconfig/network-scripts/ifcfg-eth0 - echo default via 172.16.0.2 dev eth0 > /etc/sysconfig/network-scripts/route-eth0 + echo default via 172.16.0.1 dev eth0 > /etc/sysconfig/network-scripts/route-eth0 cp /etc/firesim/network-static /etc/sysconfig/network ;; "52:54:00") diff --git a/test/fed-nw-internet.yaml b/test/fed-nw-internet.yaml index 7acc0a6f..e0597782 100644 --- a/test/fed-nw-internet.yaml +++ b/test/fed-nw-internet.yaml @@ -1,6 +1,7 @@ { "name" : "fed-nw-internet", "base" : "fedora-base.json", + "host-init" : "host-init.sh", "overlay": "overlay", "testing" : { "refDir" : "refOutput", diff --git a/test/fed-nw-internet/client.c b/test/fed-nw-internet/client.c new file mode 100644 index 00000000..c8e8267b --- /dev/null +++ b/test/fed-nw-internet/client.c @@ -0,0 +1,91 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +int main(int argc, char *argv[]) +{ + int sockfd = 0, res = 0, n = 0; + char recvBuff[1024]; + struct sockaddr_in serv_addr; + fd_set myset; + struct timeval tv; + int valopt; + socklen_t lon; + + if(argc != 2) + { + printf("\nUsage: %s \n",argv[0]); + return 1; + } + + memset(&serv_addr, '0', sizeof(serv_addr)); + + serv_addr.sin_family = AF_INET; + serv_addr.sin_port = htons(5000); + + if(inet_pton(AF_INET, argv[1], &serv_addr.sin_addr)<=0) + { + printf("\nError : inet_pton error occured\n"); + return 1; + } + + memset(recvBuff, '0',sizeof(recvBuff)); + + if((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) + { + printf("\nError : Could not create socket (%d %s) \n", errno, strerror(errno)); + return 1; + } + + + int t = 0; + while(1){ + + if(t >= 30) + { + printf("\nError : Could not connect to server (%d %s) \n", errno, strerror(errno)); + return 1; + } + if(connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) >= 0) { + break; + } + sleep(1); + + t += 1; + } + + + while ((n = read(sockfd, recvBuff, sizeof(recvBuff)-1)) > 0) + { + recvBuff[n] = 0; + if(fputs(recvBuff, stdout) == EOF) + { + printf("\nError : Fputs error\n"); + } + } + + if(n < 0) + { + printf("\nError : Read error\n"); + } else { + if (strncmp(recvBuff,argv[1],strlen(argv[1])) == 0) { + printf("\nSuccess : %s\n", argv[1]); + } else { + printf("\n Error : Expected : %s Received : %s\n", argv[1], recvBuff); + } + } + + close(sockfd); + + return 0; +} diff --git a/test/fed-nw-internet/host-init.sh b/test/fed-nw-internet/host-init.sh new file mode 100755 index 00000000..614384fa --- /dev/null +++ b/test/fed-nw-internet/host-init.sh @@ -0,0 +1,3 @@ +#!/bin/bash +riscv64-unknown-linux-gnu-gcc client.c -o overlay/root/client +riscv64-unknown-linux-gnu-gcc server.c -o overlay/root/server diff --git a/test/fed-nw-internet/overlay/root/client b/test/fed-nw-internet/overlay/root/client deleted file mode 100755 index 7879b641f2bf7efb1a5e789b5e4564965ea8da70..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12456 zcmd5?3vg7|c|LdV>Mf)d3kYf_zF0O0$65(YY=L=5D}<~>2n@#YgZ8qzdnGNbcGtTr zf^4Tq!m_|^2$Z&)0G>X`VE7}M`R z_x!7Sua?A}Os73Nd(S!F|2Y47-t(Vx_jLBG4``a;5D;$*%7rQ%tW6Ob8=XW6qBhYg zD)78kEEJ{42PNjv+oUw{IP&i))f|^QY(iIZtpNvU4LFP(FI0RSD>YIp*)Sd46d}&e zawr^&kdr4avbDU%$(MiJk>mKdvg5RhS&p(KXDB&C$#HyM70)r(kJ^O(+mya-s(u_B zpiwa7)8VD$rhm`JNp82Q$L?890UXa!{2UW6h1(%Vc7D{Lnni3@l>2dkAS=TV1fHvVM_ zt3pgwuTXi4h@ZaQ}N+*(KP?=N)*%sBt?-RFw zvm|iv+G^1j8Y4EgiP9W+TvMLPB3ZJP>O=J+Tc|!%hvzoz`oYpC$7eP7u6`$?FTGl8 zc>gcI{Pn|EU-QnkP{rT8|Ao*4#~%Erwbg&S>9b#|-MZ?DuipEmTWjl^^R;aozWm_d zePZX_B_I3atD&Z7Fo06KX3D)*wkdqdhwo8%iw~#%AUz=;-lgz1AHG82n|ydi;pcq# zE`^W!a9iQWefWHZpZ4KoBmK|&@J59TwVoj>!wx)&|DcaQu5iPL-=*;FK75(NpZDRv z54=vy6DJL){drvwm^T*9kefv=ZSA!4Vlbah09V$I#laI#59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mK}nxnLbh~^oOKl+tdO1;>)4%8-U5H}pPnD^t|2@2pqNd&>#X8? Xl5xo$h~e_<*Ke})F%GsTiDdr{v#+mM diff --git a/test/fed-nw-internet/overlay/root/test-client-1.sh b/test/fed-nw-internet/overlay/root/test-client-1.sh index cc0ee743..dfce50ff 100755 --- a/test/fed-nw-internet/overlay/root/test-client-1.sh +++ b/test/fed-nw-internet/overlay/root/test-client-1.sh @@ -1,7 +1,7 @@ #/bin/bash ip_read=`ip -f inet addr show eth0 | grep -Po 'inet \K[\d.]+'` -if [ "$ip_read" = "172.16.0.5" ]; then - /root/client 172.16.0.4 +if [ "$ip_read" = "172.16.0.3" ]; then + /root/client 172.16.0.2 if [ "$?" -eq "0" ]; then echo 'Success : ip + client' else @@ -9,4 +9,6 @@ if [ "$ip_read" = "172.16.0.5" ]; then fi else echo 'Failed : ip' + echo 'Expected : 172.16.0.3' + echo 'Received : $ip_read' fi diff --git a/test/fed-nw-internet/overlay/root/test-client-2-copy.sh b/test/fed-nw-internet/overlay/root/test-client-2-copy.sh deleted file mode 100755 index 7ae0b4c1..00000000 --- a/test/fed-nw-internet/overlay/root/test-client-2-copy.sh +++ /dev/null @@ -1,15 +0,0 @@ -#/bin/bash -ip_read=`ip -f inet addr show` -str="read ip" -echo $str -echo $ip_read -if [ "$ip_read" = "172.16.0.6" ]; then - /root/client 172.16.0.4 - if [ "$?" -eq "0" ]; then - echo 'Success : ip + client' - else - echo 'Failed : client' - fi -else - echo 'Failed : ip' -fi diff --git a/test/fed-nw-internet/overlay/root/test-client-2.sh b/test/fed-nw-internet/overlay/root/test-client-2.sh index d3aa7b63..50e63c06 100755 --- a/test/fed-nw-internet/overlay/root/test-client-2.sh +++ b/test/fed-nw-internet/overlay/root/test-client-2.sh @@ -1,7 +1,7 @@ #/bin/bash ip_read=`ip -f inet addr show eth0 | grep -Po 'inet \K[\d.]+'` -if [ "$ip_read" = "172.16.0.6" ]; then - /root/client 172.16.0.4 +if [ "$ip_read" = "172.16.0.4" ]; then + /root/client 172.16.0.2 if [ "$?" -eq "0" ]; then echo 'Success : ip + client' else @@ -9,4 +9,6 @@ if [ "$ip_read" = "172.16.0.6" ]; then fi else echo 'Failed : ip' + echo 'Expected : 172.16.0.4' + echo 'Received : $ip_read' fi diff --git a/test/fed-nw-internet/overlay/root/test-server.sh b/test/fed-nw-internet/overlay/root/test-server.sh index 5536978d..52b97bce 100755 --- a/test/fed-nw-internet/overlay/root/test-server.sh +++ b/test/fed-nw-internet/overlay/root/test-server.sh @@ -1,6 +1,6 @@ #/bin/bash ip_read=`ip -f inet addr show eth0 | grep -Po 'inet \K[\d.]+'` -if [ "$ip_read" = "172.16.0.4" ]; then +if [ "$ip_read" = "172.16.0.2" ]; then /root/server 2 if [ "$?" -eq "0" ]; then echo 'Success : ip + server' @@ -9,4 +9,6 @@ if [ "$ip_read" = "172.16.0.4" ]; then fi else echo 'Failed : ip' + echo 'Expected : 172.16.0.2' + echo 'Received : $ip_read' fi diff --git a/test/fed-nw-internet/server.c b/test/fed-nw-internet/server.c new file mode 100644 index 00000000..50f55833 --- /dev/null +++ b/test/fed-nw-internet/server.c @@ -0,0 +1,56 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + if(argc != 2) + { + printf("\nUsage: %s \n",argv[0]); + return 1; + } + + int num_clients = *(int *)(argv[1]); + + int listenfd = 0, connfd = 0; + struct sockaddr_in serv_addr; + + char sendBuff[1025]; + time_t ticks; + + listenfd = socket(AF_INET, SOCK_STREAM, 0); + memset(&serv_addr, '0', sizeof(serv_addr)); + memset(sendBuff, '0', sizeof(sendBuff)); + + serv_addr.sin_family = AF_INET; + serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); + serv_addr.sin_port = htons(5000); + + bind(listenfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)); + + listen(listenfd, 10); + + for (int i = 0; i < 2; i += 1) { + + connfd = accept(listenfd, (struct sockaddr*)NULL, NULL); + + printf("Sending\n"); + snprintf(sendBuff, sizeof(sendBuff), "172.16.0.2\r\n"); + write(connfd, sendBuff, strlen(sendBuff)); + printf("Closing\n"); + close(connfd); + } + + close(listenfd); + + return 0; + +} diff --git a/test/network.yaml b/test/network.yaml index 6e3c1483..862f5823 100644 --- a/test/network.yaml +++ b/test/network.yaml @@ -1,7 +1,8 @@ { "name" : "network", "base" : "br-base.json", - "overlay": "overlay", + "overlay" : "overlay", + "host-init" : "host-init.sh", "testing" : { "refDir" : "refOutput", "strip" : true diff --git a/test/network/client.c b/test/network/client.c new file mode 100644 index 00000000..c8e8267b --- /dev/null +++ b/test/network/client.c @@ -0,0 +1,91 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +int main(int argc, char *argv[]) +{ + int sockfd = 0, res = 0, n = 0; + char recvBuff[1024]; + struct sockaddr_in serv_addr; + fd_set myset; + struct timeval tv; + int valopt; + socklen_t lon; + + if(argc != 2) + { + printf("\nUsage: %s \n",argv[0]); + return 1; + } + + memset(&serv_addr, '0', sizeof(serv_addr)); + + serv_addr.sin_family = AF_INET; + serv_addr.sin_port = htons(5000); + + if(inet_pton(AF_INET, argv[1], &serv_addr.sin_addr)<=0) + { + printf("\nError : inet_pton error occured\n"); + return 1; + } + + memset(recvBuff, '0',sizeof(recvBuff)); + + if((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) + { + printf("\nError : Could not create socket (%d %s) \n", errno, strerror(errno)); + return 1; + } + + + int t = 0; + while(1){ + + if(t >= 30) + { + printf("\nError : Could not connect to server (%d %s) \n", errno, strerror(errno)); + return 1; + } + if(connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) >= 0) { + break; + } + sleep(1); + + t += 1; + } + + + while ((n = read(sockfd, recvBuff, sizeof(recvBuff)-1)) > 0) + { + recvBuff[n] = 0; + if(fputs(recvBuff, stdout) == EOF) + { + printf("\nError : Fputs error\n"); + } + } + + if(n < 0) + { + printf("\nError : Read error\n"); + } else { + if (strncmp(recvBuff,argv[1],strlen(argv[1])) == 0) { + printf("\nSuccess : %s\n", argv[1]); + } else { + printf("\n Error : Expected : %s Received : %s\n", argv[1], recvBuff); + } + } + + close(sockfd); + + return 0; +} diff --git a/test/network/host-init.sh b/test/network/host-init.sh new file mode 100755 index 00000000..614384fa --- /dev/null +++ b/test/network/host-init.sh @@ -0,0 +1,3 @@ +#!/bin/bash +riscv64-unknown-linux-gnu-gcc client.c -o overlay/root/client +riscv64-unknown-linux-gnu-gcc server.c -o overlay/root/server diff --git a/test/network/overlay/root/client b/test/network/overlay/root/client deleted file mode 100755 index 7879b641f2bf7efb1a5e789b5e4564965ea8da70..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12456 zcmd5?3vg7|c|LdV>Mf)d3kYf_zF0O0$65(YY=L=5D}<~>2n@#YgZ8qzdnGNbcGtTr zf^4Tq!m_|^2$Z&)0G>X`VE7}M`R z_x!7Sua?A}Os73Nd(S!F|2Y47-t(Vx_jLBG4``a;5D;$*%7rQ%tW6Ob8=XW6qBhYg zD)78kEEJ{42PNjv+oUw{IP&i))f|^QY(iIZtpNvU4LFP(FI0RSD>YIp*)Sd46d}&e zawr^&kdr4avbDU%$(MiJk>mKdvg5RhS&p(KXDB&C$#HyM70)r(kJ^O(+mya-s(u_B zpiwa7)8VD$rhm`JNp82Q$L?890UXa!{2UW6h1(%Vc7D{Lnni3@l>2dkAS=TV1fHvVM_ zt3pgwuTXi4h@ZaQ}N+*(KP?=N)*%sBt?-RFw zvm|iv+G^1j8Y4EgiP9W+TvMLPB3ZJP>O=J+Tc|!%hvzoz`oYpC$7eP7u6`$?FTGl8 zc>gcI{Pn|EU-QnkP{rT8|Ao*4#~%Erwbg&S>9b#|-MZ?DuipEmTWjl^^R;aozWm_d zePZX_B_I3atD&Z7Fo06KX3D)*wkdqdhwo8%iw~#%AUz=;-lgz1AHG82n|ydi;pcq# zE`^W!a9iQWefWHZpZ4KoBmK|&@J59TwVoj>!wx)&|DcaQu5i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RBIA8cr>R+>h{`bX^LllkKlH4Cw{FmGQ4dQ5`g*sN) zAYUohR;d4wIFjfmK}nxnLbh~^oOKl+tdO1;>)4%8-U5H}pPnD^t|2@2pqNd&>#X8? Xl5xo$h~e_<*Ke})F%GsTiDdr{v#+mM diff --git a/test/network/overlay/root/test-client-1.sh b/test/network/overlay/root/test-client-1.sh index af9a006e..6005974f 100755 --- a/test/network/overlay/root/test-client-1.sh +++ b/test/network/overlay/root/test-client-1.sh @@ -1,7 +1,7 @@ #/bin/bash ip_read=`ifconfig eth0 | grep "inet " | awk -F'[: ]+' '{ print $4 }'` -if [ "$ip_read" = "172.16.0.5" ]; then - /root/client 172.16.0.4 +if [ "$ip_read" = "172.16.0.3" ]; then + /root/client 172.16.0.2 if [ "$?" -eq "0" ]; then echo 'Success : ip + client' else @@ -9,4 +9,6 @@ if [ "$ip_read" = "172.16.0.5" ]; then fi else echo 'Failed : ip' + echo 'Expected : 172.16.0.3' + echo 'Received : $ip_read' fi diff --git a/test/network/overlay/root/test-client-2.sh b/test/network/overlay/root/test-client-2.sh index c1fceb35..9a72c060 100755 --- a/test/network/overlay/root/test-client-2.sh +++ b/test/network/overlay/root/test-client-2.sh @@ -1,7 +1,7 @@ #/bin/bash ip_read=`ifconfig eth0 | grep "inet " | awk -F'[: ]+' '{ print $4 }'` -if [ "$ip_read" = "172.16.0.6" ]; then - /root/client 172.16.0.4 +if [ "$ip_read" = "172.16.0.4" ]; then + /root/client 172.16.0.2 if [ "$?" -eq "0" ]; then echo 'Success : ip + client' else @@ -9,4 +9,6 @@ if [ "$ip_read" = "172.16.0.6" ]; then fi else echo 'Failed : ip' + echo 'Expected : 172.16.0.4' + echo 'Received : $ip_read' fi diff --git a/test/network/overlay/root/test-server.sh b/test/network/overlay/root/test-server.sh index 59061359..d819e815 100755 --- a/test/network/overlay/root/test-server.sh +++ b/test/network/overlay/root/test-server.sh @@ -1,6 +1,6 @@ #/bin/bash ip_read=`ifconfig eth0 | grep "inet " | awk -F'[: ]+' '{ print $4 }'` -if [ "$ip_read" = "172.16.0.4" ]; then +if [ "$ip_read" = "172.16.0.2" ]; then /root/server 2 if [ "$?" -eq "0" ]; then echo 'Success : ip + server' @@ -9,4 +9,6 @@ if [ "$ip_read" = "172.16.0.4" ]; then fi else echo 'Failed : ip' + echo 'Expected : 172.16.0.2' + echo 'Received : $ip_read' fi diff --git a/test/network/server.c b/test/network/server.c new file mode 100644 index 00000000..50f55833 --- /dev/null +++ b/test/network/server.c @@ -0,0 +1,56 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + if(argc != 2) + { + printf("\nUsage: %s \n",argv[0]); + return 1; + } + + int num_clients = *(int *)(argv[1]); + + int listenfd = 0, connfd = 0; + struct sockaddr_in serv_addr; + + char sendBuff[1025]; + time_t ticks; + + listenfd = socket(AF_INET, SOCK_STREAM, 0); + memset(&serv_addr, '0', sizeof(serv_addr)); + memset(sendBuff, '0', sizeof(sendBuff)); + + serv_addr.sin_family = AF_INET; + serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); + serv_addr.sin_port = htons(5000); + + bind(listenfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)); + + listen(listenfd, 10); + + for (int i = 0; i < 2; i += 1) { + + connfd = accept(listenfd, (struct sockaddr*)NULL, NULL); + + printf("Sending\n"); + snprintf(sendBuff, sizeof(sendBuff), "172.16.0.2\r\n"); + write(connfd, sendBuff, strlen(sendBuff)); + printf("Closing\n"); + close(connfd); + } + + close(listenfd); + + return 0; + +} diff --git a/wlutil/launch.py b/wlutil/launch.py index 176e7342..89847c25 100644 --- a/wlutil/launch.py +++ b/wlutil/launch.py @@ -25,7 +25,7 @@ def startVDE(): log = logging.getLogger() global vdeProc log.info('Starting VDE') - vdeProc = sp.Popen(["vde_plug", "vxvde://", "slirp:///host=172.16.0.2"], stderr=sp.STDOUT) + vdeProc = sp.Popen(["vde_plug", "vxvde://", "cmd://slirpvde - --host=172.16.0.1/16 --dns=172.16.1.3"], stderr=sp.STDOUT) # Terminate vdeProc unless it has stopped running already @@ -73,7 +73,6 @@ def getSpikeCmd(config, nodisk=False): # Returns a command string to luanch the given config in qemu. Must be called with shell=True. def getQemuCmd(config, count=1, nodisk=False): - # launch_port = get_free_tcp_port() if nodisk: exe = str(wlutil.noDiskPath(config['bin'])) @@ -85,8 +84,8 @@ def getQemuCmd(config, count=1, nodisk=False): else: qemuBin = 'qemu-system-riscv64' - # We should start static IP addresses at 172.16.0.4 => 4 = 1 (min val of count) + 3 - count += 3 + # We should start static IP addresses at 172.16.0.2 => 4 = 1 (min val of count) + 1 + count += 1 machigh = '00' if count < 16: maclow = '0' + hex(count)[2:] @@ -103,7 +102,6 @@ def getQemuCmd(config, count=1, nodisk=False): '-object', 'rng-random,filename=/dev/urandom,id=rng0', '-device', 'virtio-rng-device,rng=rng0', '-device', f'virtio-net-device,netdev=vde0,mac=00:12:6d:00:{machigh}:{maclow}', - #'-netdev', 'user,id=usernet,hostfwd=tcp::' + launch_port + '-:22'] '-netdev', 'vde,id=vde0,sock=vxvde://'] if 'img' in config and not nodisk: @@ -124,6 +122,8 @@ def launchWorkload(baseConfig, jobs=None, spike=False, silent=False, captureOutp silent: If false, the output from the simulator will be displayed to stdout. If true, only the uartlog will be written (it is written live and unbuffered so users can still 'tail' the output if they'd like). + captureOutput: If true, the output for each workload will be captured in a uartlog file stored + in a separate workload specific directory. If false, no output will be captured. (Useful for building workloads.) Returns: Path of output directory """ @@ -148,16 +148,16 @@ def launchWorkload(baseConfig, jobs=None, spike=False, silent=False, captureOutp screenIdentifiers = {} try: - count = 0; + jobSlot = 0; for config in configs: if config['launch']: - count += 1 + jobSlot += 1 if spike: cmd = getSpikeCmd(config, config['nodisk']) else: - cmd = getQemuCmd(config, count, config['nodisk']) + cmd = getQemuCmd(config, jobSlot, config['nodisk']) log.info(f"\nLaunching job {config['name']}") log.info(f'Running: {cmd}') From a5e391cf808f511e3b883cb2a558a888f4683e8d Mon Sep 17 00:00:00 2001 From: Raghav Gupta Date: Fri, 8 Apr 2022 23:17:46 +0000 Subject: [PATCH 08/16] Updated tutorial to include networking --- docs/source/Tutorials/paralleljobs.rst | 51 +++++++++++++++++++++++--- docs/source/commands.rst | 2 +- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/docs/source/Tutorials/paralleljobs.rst b/docs/source/Tutorials/paralleljobs.rst index 3c186459..c808f4e9 100644 --- a/docs/source/Tutorials/paralleljobs.rst +++ b/docs/source/Tutorials/paralleljobs.rst @@ -4,7 +4,7 @@ Parallel Jobs ====================== ``example-workloads/parallelJobs.yaml`` -FireMarshal is capable of running multiple jobs in parallel. To understand how this feature works, let's use the ``parallelJobs.yaml`` workload as an example. +FireMarshal is capable of running multiple networked jobs in parallel. To understand how this feature works, let's use the ``parallelJobs.yaml`` workload as an example. .. include:: ../../../example-workloads/parallelJobs.yaml :code: json @@ -28,7 +28,23 @@ The default login details for all workloads are: ``Password:`` ``firesim`` -Once logged in, you can run commands in the terminal. To exit, use: +Once logged in, you can run commands in the terminal. + +FireMarshal uses a Virtual Distributed Ethernet (VDE) network with a gateway at ``172.16.0.1`` and DNS nameserver at ``172.16.1.3``. It assigns IP addresses starting with ``172.16.0.2``. + +We expect the root workload to have an IP address of ``172.16.0.2``. We can check the IP address assigned to interface ``eth0`` with: + +:: + + ip addr show eth0 + +We can also test conncectivity to the internet with: + +:: + + wget -S fires.im + +To exit, use: :: @@ -61,28 +77,51 @@ For instance, attach to job ``j0``, using: screen -r parallelJobs-j0 +You need to login with the the details provided above. + +We expect job ``j0`` to have IP address ``172.16.0.2`` and job ``j1`` to have IP address ``172.16.0.3``. Let's test these out! + +Inside job ``j0``, run: + +:: + + ip addr show eth0 + To detach from inside the screen session, use ``ctrl-a`` then ``ctrl-d``. -Similarly, attach to job ``j1``, using: +Again, we can attach to job ``j1``, using: :: screen -r parallelJobs-j1 +Similarly, we test the IP address of job ``j1`` with: + +:: + + ip addr show eth0 + +Jobs ``j0`` and ``j1`` should be able to communicate with each other over the network. We can try this feature by pinging ``j0 (172.16.0.2)`` from ``j1``: + +:: + + ping 172.16.0.2 + +You should see the command print the result of sending and receiving packets. We can terminate this command with ``Ctrl/Command + C``. -Login (with the details provided above) and then use the ``poweroff`` command to shut job ``j1`` down. +Now, use the ``poweroff`` command to shut job ``j1`` down. -Now re-attach to job ``j0``, using: +Then, re-attach to job ``j0``, using: :: screen -r parallelJobs-j0 -Login (with the details provided above) and then use the ``poweroff`` command to shut job ``j0`` down. +Again, use the ``poweroff`` command to shut job ``j0`` down. FireMarshal also logs ``stdout`` and ``stderr`` to a ``uartlog`` file for each workload. These files can be found inside the corresponding workload output directory inside ``runOutputs``. The path to this directory will be output by the ``launch`` command. For instance, a workload output directory for the launched ``parallelJobs`` workload would be called ``parallelJobs-launch-YYYY-MM-DD--HH-MM-SS-``. diff --git a/docs/source/commands.rst b/docs/source/commands.rst index b91c5980..33f34826 100644 --- a/docs/source/commands.rst +++ b/docs/source/commands.rst @@ -83,7 +83,7 @@ Launch all jobs in the workload. Jobs will be run sequentially. See the ``-j --job`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ In workloads with multiple jobs, you can specify which job(s) to launch. -FireMarshal supports running multiple jobs concurrently but does not support networked jobs yet. Jobs are identified by their ``name`` attribute. Multiple ``-j`` +FireMarshal supports running multiple networked jobs concurrently. Jobs are identified by their ``name`` attribute. Multiple ``-j`` options may be passed to invoke multiple jobs. Use ``--all`` to launch all jobs in the workload. If neither ``--job`` nor ``--all`` are provided, the root workload will be run. The root workload is the parent of all the jobs (i.e. the From 606416abd3199e573d2e643ca50377e4d6fcddb8 Mon Sep 17 00:00:00 2001 From: Raghav Gupta Date: Thu, 21 Apr 2022 08:59:59 +0000 Subject: [PATCH 09/16] Updated centos/ubuntu reqs + created marshal-dependencies script + added dependencies dir to .gitignore --- .gitignore | 1 + centos-requirements.txt | 5 + gccwrap-centos | 3 + gccwrap-ubuntu | 3 + marshal-dependencies.sh | 240 ++++++++++++++++++++++++++++++++++++++++ ubuntu-requirements.txt | 4 + 6 files changed, 256 insertions(+) create mode 100755 gccwrap-centos create mode 100755 gccwrap-ubuntu create mode 100755 marshal-dependencies.sh diff --git a/.gitignore b/.gitignore index dfab433e..0b3a51bc 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ wlutil/_command.sh .doit.db* marshal-config.yaml .ropeproject +dependencies diff --git a/centos-requirements.txt b/centos-requirements.txt index 110729a2..b4dfe2c9 100644 --- a/centos-requirements.txt +++ b/centos-requirements.txt @@ -15,3 +15,8 @@ glib-devel gtk2-devel ctags bc +openssl-devel +pkgconfig +glib2-devel +unzip +wget diff --git a/gccwrap-centos b/gccwrap-centos new file mode 100755 index 00000000..8afa1ede --- /dev/null +++ b/gccwrap-centos @@ -0,0 +1,3 @@ +#!/bin/sh + +exec gcc -I "${MARSHAL_PREFIX}/include" -L "${MARSHAL_PREFIX}/lib64" -L "${MARSHAL_PREFIX}/lib64/x86_64-linux-gnu" "$@" diff --git a/gccwrap-ubuntu b/gccwrap-ubuntu new file mode 100755 index 00000000..4bdab126 --- /dev/null +++ b/gccwrap-ubuntu @@ -0,0 +1,3 @@ +#!/bin/sh + +exec gcc -I "${MARSHAL_PREFIX}/include" -L "${MARSHAL_PREFIX}/lib" -L "${MARSHAL_PREFIX}/lib/x86_64-linux-gnu" "$@" diff --git a/marshal-dependencies.sh b/marshal-dependencies.sh new file mode 100755 index 00000000..a2f58d4e --- /dev/null +++ b/marshal-dependencies.sh @@ -0,0 +1,240 @@ +#!/bin/bash +#set -x + +# thanks to Giacomo Rizzi: some ideas have been taken from: https://github.com/gufoe/vuos-tutorial + +while getopts p: flag +do + case "${flag}" in + p) prefix=${OPTARG};; + esac +done + +BASE=$(pwd) +echo "BASE: $BASE" + +function check_env { + if [ -z ${RISCV} ] + then + echo "RISCV environment variable NOT FOUND" + exit 1 + fi + + _=$(which apt) + if [ $? -eq 0 ] + then + os="deb/ubuntu" + else + _=$(which yum) + if [ $? -eq 0 ] + then + os="centos" + else + echo "yum/apt NOT FOUND" + exit 1 + fi + fi + +} + +function check_deps { + _=$(which python3.8) + if [ $? -ne 0 ] + then + echo "python3.8 not found" + exit 1 + fi + + _=$(which unzip) + if [ $? -ne 0 ] + then + echo "unzip not found" + exit 1 + fi + + _=$(which wget) + if [ $? -ne 0 ] + then + echo "wget not found" + exit 1 + fi + +} + +check_env + +check_deps + +# User friendly messages on error +set -E +set -o functrace +function handle_error { + local retval=$? + local line=${last_lineno:-$1} + echo "Failed at $line: $BASH_COMMAND" + echo "Trace: " "$@" + exit $retval +} +if (( ${BASH_VERSION%%.*} <= 3 )) || [[ ${BASH_VERSION%.*} = 4.0 ]]; then + trap '[[ $FUNCNAME = handle_error ]] || { last_lineno=$real_lineno; real_lineno=$LINENO; }' DEBUG +fi +trap 'handle_error $LINENO ${BASH_LINENO[@]}' ERR + +function install_repo { + REPO=$1 + NAME=$2 + PREWD=$(pwd) + echo installing $1 + cd "$BASE"/dependencies + mkdir $NAME + wget $REPO -O $NAME.tar.gz + tar -xvzf $NAME.tar.gz -C $NAME --strip-components=1 + cd $NAME + + echo CMAKE + mkdir -p build + cd build + if [ -z "$prefix" ] + then + cmake .. $2 + make + else + if [ "$os" = "deb/ubuntu" ] + then + MARSHAL_PREFIX=$prefix CC=$BASE/gccwrap-ubuntu $prefix/bin/cmake .. -DCMAKE_PREFIX_PATH=$prefix -DCMAKE_INSTALL_PREFIX=$prefix + C_INCLUDE_PATH="$prefix/include" LIBRARY_PATH="$prefix/lib" make + else + MARSHAL_PREFIX=$prefix CC=$BASE/gccwrap-centos $prefix/bin/cmake .. -DCMAKE_PREFIX_PATH=$prefix -DCMAKE_INSTALL_PREFIX=$prefix + C_INCLUDE_PATH="$prefix/include" LIBRARY_PATH="$prefix/lib64" make + fi + fi + make install + + + cd $PREWD +} + +function install_cmake { + PREWD=$(pwd) + version=3.23 + build=0 + echo installing cmake-$version.$build + cd "$BASE"/dependencies + wget https://github.com/Kitware/CMake/releases/download/v$version.$build/cmake-$version.$build-linux-x86_64.sh + if [ -z "$prefix" ] + then + bash cmake-$version.$build-linux-x86_64.sh --prefix="/usr/local/bin" --exclude-subdir --skip-license + else + bash cmake-$version.$build-linux-x86_64.sh --prefix=$prefix --exclude-subdir --skip-license + fi + cd $PREWD +} + +function install_meson { + PREWD=$(pwd) + release=0.61.4 + echo installing meson-$release + cd "$BASE"/dependencies + mkdir meson + wget https://github.com/mesonbuild/meson/releases/download/$release/meson-$release.tar.gz -O meson.tar.gz + tar -xzvf meson.tar.gz -C meson --strip-components=1 + cd $PREWD +} + +function install_ninja { + PREWD=$(pwd) + release=1.10.2 + echo installing ninja-$release + cd "$BASE"/dependencies + wget https://github.com/ninja-build/ninja/releases/download/v$release/ninja-linux.zip + if [ -z "$prefix" ] + then + unzip -d /usr/local/bin/ ninja-linux.zip + else + unzip -d $prefix/bin/ ninja-linux.zip + fi + cd $PREWD +} + +function install_libslirp { + PREWD=$(pwd) + release=4.6.1 + echo installing libslirp + cd "$BASE"/dependencies + mkdir libslirp + wget https://gitlab.freedesktop.org/slirp/libslirp/-/archive/v$release/libslirp-v$release.tar.gz -O libslirp.tar.gz + tar -xvzf libslirp.tar.gz -C libslirp --strip-components=1 + cd libslirp + if [ -z "$prefix" ] + then + python3.8 ../meson/meson.py build + ninja -C build install + else + NINJA=$prefix/bin/ninja python3.8 ../meson/meson.py build -Dprefix=$prefix + $prefix/bin/ninja -C build install + fi + cd $PREWD +} + +function install_qemu { + PREWD=$(pwd) + release=6.2.0 + echo installing qemu-$release + cd "$BASE"/dependencies + mkdir qemu + wget https://download.qemu.org/qemu-$release.tar.xz -O qemu.tar.xz + tar -xvJf qemu.tar.xz -C qemu --strip-components=1 + cd qemu + + mkdir -p build + cd build + if [ -z "$prefix" ] + then + ../configure --target-list=riscv64-softmu --enable-vde --disable-werror + make + else + if [ "$os" = "deb/ubuntu" ] + then + MARSHAL_PREFIX=$prefix ../configure --prefix=$prefix --interp-prefix=$prefix --cc=$BASE/gccwrap-ubuntu --target-list=riscv64-softmmu --enable-vde --disable-werror + C_INCLUDE_PATH="$prefix/include" LIBRARY_PATH="$prefix/lib" make + else + MARSHAL_PREFIX=$prefix ../configure --prefix=$prefix --interp-prefix=$prefix --cc=$BASE/gccwrap-centos --target-list=riscv64-softmmu --enable-vde --disable-werror + C_INCLUDE_PATH="$prefix/include" LIBRARY_PATH="$prefix/lib64" make + fi + fi + make install + + + cd $PREWD +} + +# Start installation + +rm -rf dependencies +mkdir dependencies + +if [ -z "$prefix" ] +then + prefix=${RISCV} +fi + +if [ -n "$prefix" ] +then + export PATH="$prefix:$prefix/bin:${PATH}" +fi + +install_cmake +install_ninja +install_meson +install_libslirp + +install_repo https://github.com/virtualsquare/s2argv-execs/archive/refs/tags/1.3.tar.gz s2argv-execs +install_repo https://github.com/rd235/vdeplug4/archive/refs/tags/v4.0.1.tar.gz vdeplug4 +install_repo https://github.com/virtualsquare/libvdeslirp/archive/refs/tags/0.1.1.tar.gz libvdeslirp +install_repo https://github.com/virtualsquare/vdeplug_slirp/archive/refs/tags/0.1.0.tar.gz vdeplug_slirp + +install_qemu + +./init-submodules.sh + +echo 'Installation completed' diff --git a/ubuntu-requirements.txt b/ubuntu-requirements.txt index 7418d274..4c22b093 100644 --- a/ubuntu-requirements.txt +++ b/ubuntu-requirements.txt @@ -15,3 +15,7 @@ ctags bc e2fsprogs unzip +build-essential +libssl-dev +pkg-config +wget From f81a34674a3d9832352e6313aede80ae145bdf98 Mon Sep 17 00:00:00 2001 From: Raghav Gupta Date: Thu, 21 Apr 2022 23:19:28 +0000 Subject: [PATCH 10/16] fixed tab + lint errors --- test/fed-nw-internet/client.c | 135 +++++++++++++++++----------------- test/fed-nw-internet/server.c | 80 ++++++++++---------- test/network/client.c | 134 ++++++++++++++++----------------- test/network/server.c | 80 ++++++++++---------- wlutil/launch.py | 11 ++- 5 files changed, 222 insertions(+), 218 deletions(-) diff --git a/test/fed-nw-internet/client.c b/test/fed-nw-internet/client.c index c8e8267b..85cdb9df 100644 --- a/test/fed-nw-internet/client.c +++ b/test/fed-nw-internet/client.c @@ -14,78 +14,79 @@ int main(int argc, char *argv[]) { - int sockfd = 0, res = 0, n = 0; - char recvBuff[1024]; - struct sockaddr_in serv_addr; - fd_set myset; - struct timeval tv; - int valopt; - socklen_t lon; - - if(argc != 2) - { - printf("\nUsage: %s \n",argv[0]); - return 1; - } - - memset(&serv_addr, '0', sizeof(serv_addr)); - - serv_addr.sin_family = AF_INET; - serv_addr.sin_port = htons(5000); - - if(inet_pton(AF_INET, argv[1], &serv_addr.sin_addr)<=0) - { - printf("\nError : inet_pton error occured\n"); - return 1; - } - - memset(recvBuff, '0',sizeof(recvBuff)); - - if((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) - { - printf("\nError : Could not create socket (%d %s) \n", errno, strerror(errno)); - return 1; - } - - - int t = 0; - while(1){ - - if(t >= 30) - { - printf("\nError : Could not connect to server (%d %s) \n", errno, strerror(errno)); - return 1; - } - if(connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) >= 0) { - break; - } - sleep(1); - - t += 1; + int sockfd = 0, res = 0, n = 0; + char recvBuff[1024]; + struct sockaddr_in serv_addr; + fd_set myset; + struct timeval tv; + int valopt; + socklen_t lon; + + if(argc != 2) + { + printf("\nUsage: %s \n",argv[0]); + return 1; + } + + memset(&serv_addr, '0', sizeof(serv_addr)); + + serv_addr.sin_family = AF_INET; + serv_addr.sin_port = htons(5000); + + if(inet_pton(AF_INET, argv[1], &serv_addr.sin_addr)<=0) + { + printf("\nError : inet_pton error occured\n"); + return 1; + } + + memset(recvBuff, '0',sizeof(recvBuff)); + + if((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) + { + printf("\nError : Could not create socket (%d %s) \n", errno, strerror(errno)); + return 1; + } + + + int t = 0; + while(1){ + + if(t >= 30) + { + printf("\nError : Could not connect to server (%d %s) \n", errno, strerror(errno)); + return 1; + } + + if(connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) >= 0) { + break; + } + sleep(1); + + t += 1; } - while ((n = read(sockfd, recvBuff, sizeof(recvBuff)-1)) > 0) - { - recvBuff[n] = 0; - if(fputs(recvBuff, stdout) == EOF) - { - printf("\nError : Fputs error\n"); - } - } - - if(n < 0) - { - printf("\nError : Read error\n"); - } else { - if (strncmp(recvBuff,argv[1],strlen(argv[1])) == 0) { - printf("\nSuccess : %s\n", argv[1]); - } else { + while ((n = read(sockfd, recvBuff, sizeof(recvBuff)-1)) > 0) + { + recvBuff[n] = 0; + if(fputs(recvBuff, stdout) == EOF) + { + printf("\nError : Fputs error\n"); + } + } + + if(n < 0) + { + printf("\nError : Read error\n"); + } else { + if (strncmp(recvBuff,argv[1],strlen(argv[1])) == 0) { + printf("\nSuccess : %s\n", argv[1]); + } else { printf("\n Error : Expected : %s Received : %s\n", argv[1], recvBuff); } - } + } - close(sockfd); + close(sockfd); - return 0; + return 0; } diff --git a/test/fed-nw-internet/server.c b/test/fed-nw-internet/server.c index 50f55833..084e3b42 100644 --- a/test/fed-nw-internet/server.c +++ b/test/fed-nw-internet/server.c @@ -12,45 +12,45 @@ int main(int argc, char *argv[]) { - if(argc != 2) - { - printf("\nUsage: %s \n",argv[0]); - return 1; - } - - int num_clients = *(int *)(argv[1]); - - int listenfd = 0, connfd = 0; - struct sockaddr_in serv_addr; - - char sendBuff[1025]; - time_t ticks; - - listenfd = socket(AF_INET, SOCK_STREAM, 0); - memset(&serv_addr, '0', sizeof(serv_addr)); - memset(sendBuff, '0', sizeof(sendBuff)); - - serv_addr.sin_family = AF_INET; - serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); - serv_addr.sin_port = htons(5000); - - bind(listenfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)); - - listen(listenfd, 10); - - for (int i = 0; i < 2; i += 1) { - - connfd = accept(listenfd, (struct sockaddr*)NULL, NULL); - - printf("Sending\n"); - snprintf(sendBuff, sizeof(sendBuff), "172.16.0.2\r\n"); - write(connfd, sendBuff, strlen(sendBuff)); - printf("Closing\n"); - close(connfd); - } - - close(listenfd); - - return 0; + if(argc != 2) + { + printf("\nUsage: %s \n",argv[0]); + return 1; + } + + int num_clients = *(int *)(argv[1]); + + int listenfd = 0, connfd = 0; + struct sockaddr_in serv_addr; + + char sendBuff[1025]; + time_t ticks; + + listenfd = socket(AF_INET, SOCK_STREAM, 0); + memset(&serv_addr, '0', sizeof(serv_addr)); + memset(sendBuff, '0', sizeof(sendBuff)); + + serv_addr.sin_family = AF_INET; + serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); + serv_addr.sin_port = htons(5000); + + bind(listenfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)); + + listen(listenfd, 10); + + for (int i = 0; i < 2; i += 1) { + + connfd = accept(listenfd, (struct sockaddr*)NULL, NULL); + + printf("Sending\n"); + snprintf(sendBuff, sizeof(sendBuff), "172.16.0.2\r\n"); + write(connfd, sendBuff, strlen(sendBuff)); + printf("Closing\n"); + close(connfd); + } + + close(listenfd); + + return 0; } diff --git a/test/network/client.c b/test/network/client.c index c8e8267b..e5114d63 100644 --- a/test/network/client.c +++ b/test/network/client.c @@ -14,78 +14,78 @@ int main(int argc, char *argv[]) { - int sockfd = 0, res = 0, n = 0; - char recvBuff[1024]; - struct sockaddr_in serv_addr; - fd_set myset; - struct timeval tv; - int valopt; - socklen_t lon; - - if(argc != 2) - { - printf("\nUsage: %s \n",argv[0]); - return 1; - } - - memset(&serv_addr, '0', sizeof(serv_addr)); - - serv_addr.sin_family = AF_INET; - serv_addr.sin_port = htons(5000); - - if(inet_pton(AF_INET, argv[1], &serv_addr.sin_addr)<=0) - { - printf("\nError : inet_pton error occured\n"); - return 1; - } - - memset(recvBuff, '0',sizeof(recvBuff)); - - if((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) - { - printf("\nError : Could not create socket (%d %s) \n", errno, strerror(errno)); - return 1; - } - - - int t = 0; - while(1){ - - if(t >= 30) - { - printf("\nError : Could not connect to server (%d %s) \n", errno, strerror(errno)); - return 1; - } - if(connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) >= 0) { - break; - } - sleep(1); - - t += 1; + int sockfd = 0, res = 0, n = 0; + char recvBuff[1024]; + struct sockaddr_in serv_addr; + fd_set myset; + struct timeval tv; + int valopt; + socklen_t lon; + + if(argc != 2) + { + printf("\nUsage: %s \n",argv[0]); + return 1; + } + + memset(&serv_addr, '0', sizeof(serv_addr)); + + serv_addr.sin_family = AF_INET; + serv_addr.sin_port = htons(5000); + + if(inet_pton(AF_INET, argv[1], &serv_addr.sin_addr)<=0) + { + printf("\nError : inet_pton error occured\n"); + return 1; + } + + memset(recvBuff, '0',sizeof(recvBuff)); + + if((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) + { + printf("\nError : Could not create socket (%d %s) \n", errno, strerror(errno)); + return 1; + } + + + int t = 0; + while(1){ + + if(t >= 30) + { + printf("\nError : Could not connect to server (%d %s) \n", errno, strerror(errno)); + return 1; + } + if(connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) >= 0) { + break; + } + sleep(1); + + t += 1; } - while ((n = read(sockfd, recvBuff, sizeof(recvBuff)-1)) > 0) - { - recvBuff[n] = 0; - if(fputs(recvBuff, stdout) == EOF) - { - printf("\nError : Fputs error\n"); - } - } - - if(n < 0) - { - printf("\nError : Read error\n"); - } else { - if (strncmp(recvBuff,argv[1],strlen(argv[1])) == 0) { - printf("\nSuccess : %s\n", argv[1]); - } else { + while ((n = read(sockfd, recvBuff, sizeof(recvBuff)-1)) > 0) + { + recvBuff[n] = 0; + if(fputs(recvBuff, stdout) == EOF) + { + printf("\nError : Fputs error\n"); + } + } + + if(n < 0) + { + printf("\nError : Read error\n"); + } else { + if (strncmp(recvBuff,argv[1],strlen(argv[1])) == 0) { + printf("\nSuccess : %s\n", argv[1]); + } else { printf("\n Error : Expected : %s Received : %s\n", argv[1], recvBuff); } - } + } - close(sockfd); + close(sockfd); - return 0; + return 0; } diff --git a/test/network/server.c b/test/network/server.c index 50f55833..084e3b42 100644 --- a/test/network/server.c +++ b/test/network/server.c @@ -12,45 +12,45 @@ int main(int argc, char *argv[]) { - if(argc != 2) - { - printf("\nUsage: %s \n",argv[0]); - return 1; - } - - int num_clients = *(int *)(argv[1]); - - int listenfd = 0, connfd = 0; - struct sockaddr_in serv_addr; - - char sendBuff[1025]; - time_t ticks; - - listenfd = socket(AF_INET, SOCK_STREAM, 0); - memset(&serv_addr, '0', sizeof(serv_addr)); - memset(sendBuff, '0', sizeof(sendBuff)); - - serv_addr.sin_family = AF_INET; - serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); - serv_addr.sin_port = htons(5000); - - bind(listenfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)); - - listen(listenfd, 10); - - for (int i = 0; i < 2; i += 1) { - - connfd = accept(listenfd, (struct sockaddr*)NULL, NULL); - - printf("Sending\n"); - snprintf(sendBuff, sizeof(sendBuff), "172.16.0.2\r\n"); - write(connfd, sendBuff, strlen(sendBuff)); - printf("Closing\n"); - close(connfd); - } - - close(listenfd); - - return 0; + if(argc != 2) + { + printf("\nUsage: %s \n",argv[0]); + return 1; + } + + int num_clients = *(int *)(argv[1]); + + int listenfd = 0, connfd = 0; + struct sockaddr_in serv_addr; + + char sendBuff[1025]; + time_t ticks; + + listenfd = socket(AF_INET, SOCK_STREAM, 0); + memset(&serv_addr, '0', sizeof(serv_addr)); + memset(sendBuff, '0', sizeof(sendBuff)); + + serv_addr.sin_family = AF_INET; + serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); + serv_addr.sin_port = htons(5000); + + bind(listenfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)); + + listen(listenfd, 10); + + for (int i = 0; i < 2; i += 1) { + + connfd = accept(listenfd, (struct sockaddr*)NULL, NULL); + + printf("Sending\n"); + snprintf(sendBuff, sizeof(sendBuff), "172.16.0.2\r\n"); + write(connfd, sendBuff, strlen(sendBuff)); + printf("Closing\n"); + close(connfd); + } + + close(listenfd); + + return 0; } diff --git a/wlutil/launch.py b/wlutil/launch.py index 89847c25..315abb71 100644 --- a/wlutil/launch.py +++ b/wlutil/launch.py @@ -7,6 +7,7 @@ jobProcs = [] vdeProc = None + # Terminates jobs unless they have stopped running already def cleanUpSubProcesses(): log = logging.getLogger() @@ -20,6 +21,7 @@ def cleanUpSubProcesses(): # Register clean up function with wlutil.py so it can be called by SIGINT handler wlutil.registerCleanUp(cleanUpSubProcesses) + # Start vde_plug server def startVDE(): log = logging.getLogger() @@ -34,7 +36,8 @@ def cleanUpVDE(): if vdeProc and vdeProc.poll() is None: log.info(f'cleaning up VDE process {vdeProc.pid}') vdeProc.terminate() - + + # Kinda hacky (technically not guaranteed to give a free port, just very likely) def get_free_tcp_port(): tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM) @@ -89,7 +92,7 @@ def getQemuCmd(config, count=1, nodisk=False): machigh = '00' if count < 16: maclow = '0' + hex(count)[2:] - else: + else: maclow = hex(count)[2:] cmd = [qemuBin, @@ -148,10 +151,10 @@ def launchWorkload(baseConfig, jobs=None, spike=False, silent=False, captureOutp screenIdentifiers = {} try: - jobSlot = 0; + jobSlot = 0 for config in configs: if config['launch']: - + jobSlot += 1 if spike: From 66ba53b7df64e3b1b8452dc3d42eeab475ea79aa Mon Sep 17 00:00:00 2001 From: Raghav Gupta Date: Fri, 22 Apr 2022 21:31:38 +0000 Subject: [PATCH 11/16] modified README.md --- README.md | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 08dbb9a7..3aec4f8c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ FireMarshal ================================== This tool builds base images for several linux-based distros that work with qemu, -spike, and firesim. +spike, and FireSim. This is just a quick primer. To see full documentation, please see the official documentation: @@ -11,8 +11,9 @@ https://firemarshal.readthedocs.io/en/latest/index.html # Requirements The easiest way to use Marshal is to run it via Chipyard (https://chipyard.readthedocs.io/en/latest/) or FireSim -(https://docs.fires.im/en/latest/). However, this is not required. To run -FireMarshal independently, you will need the following dependencies: +(https://docs.fires.im/en/latest/). However, this is not required. + +To run FireMarshal, you will need the following dependencies: ## Standard Packages ``centos-requirements.txt`` is a list of packages for centos7 that are needed by @@ -35,29 +36,33 @@ out of the box on Ubuntu. See https://github.com/firesim/firesim-software/issues/30 for a workaround. ## Python -This project was written for python 3.6. You can install all dependencies using: +This project was written for python 3.8. You can install all dependencies using: ``` pip3 install -r python-requirements.txt ``` +## Other Packages +FireMarshal depends on other open-source packages that can be installed by running: + +``` +./marshal-dependencies.sh +``` + +Note that this script downloads dependencies to a `dependencies` directory and installs them at the path pointed to by the `RISCV` environment variable. Thus, the script requires `RISCV` to be set (Chipyard/FireSim already do this). + +This script also updates submodules. + ## RISC-V Tools In addition to standard libraries, you will need a RISC-V compatible toolchain, -the RISC-V isa simulator (spike). +the RISC-V isa simulator (spike). This is already installed by Chipyard/FireSim. See the [Chipyard documentation](https://chipyard.readthedocs.io/en/latest/Chipyard-Basics/Initial-Repo-Setup.html#building-a-toolchain) for help setting up a known-good toolchain and environment. ## Qemu -Qemu is the default simulator used by firemarshal. We require version v5.0.0 or -greater. If you aren't using chipyard, you can get it from: - -https://github.com/qemu/qemu/tree/v5.0.0 +Qemu is the default simulator used by FireMarshal and it currently installs v6.2.0. # Basic Usage -If you only want to build bare-metal workloads, you can skip updating -submodules. Otherwise, you should update the required submodules by running: - - ./init-submodules.sh Building workloads: @@ -67,7 +72,7 @@ To run in qemu: ./marshal launch br-base.json -To install into FireSim (assuming you cloned this as a submodule of firesim or chipyard): +To install into FireSim (assuming you cloned this as a submodule of FireSim or Chipyard): ./marshal install br-base.json From 1306aaeb92b5e337a91d1053508a4c11116fd2e3 Mon Sep 17 00:00:00 2001 From: Raghav Gupta Date: Sun, 24 Apr 2022 00:48:20 +0000 Subject: [PATCH 12/16] Updated README.md --- README.md | 43 ++++++++++--------------------------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 3aec4f8c..1df0dd4a 100644 --- a/README.md +++ b/README.md @@ -8,60 +8,37 @@ This is just a quick primer. To see full documentation, please see the official documentation: https://firemarshal.readthedocs.io/en/latest/index.html -# Requirements +# Setup + The easiest way to use Marshal is to run it via Chipyard (https://chipyard.readthedocs.io/en/latest/) or FireSim (https://docs.fires.im/en/latest/). However, this is not required. -To run FireMarshal, you will need the following dependencies: +Run the following script to install all of FireMarshal's dependencies (standard packages from apt/yum, python libraries, open-source packages, submodules): -## Standard Packages -``centos-requirements.txt`` is a list of packages for centos7 that are needed by -marshal. You can install these with: ``` -cat centos-requirements.txt | sudo xargs yum install -y +./install/marshal-dependencies.sh ``` -``ubuntu-requirements.txt`` is a list of packages for Ubuntu 18.04 that are needed by marshal. -You can install these with: +Note that this script downloads dependencies to `install/dependencies` and installs them at the path pointed to by the `RISCV` environment variable. Thus, the script requires `RISCV` to be set and FireMarshal expects `PATH` to contain the path it points to (Chipyard/FireSim already do this). + +Running bare-metal workloads requires a minimal set of dependencies. You can install just these by passing the `-b` flag as follows: + ``` -cat ubuntu-requirements.txt | sudo xargs apt-get install -y +./install/marshal-dependencies.sh -b ``` -Package names may be different on other distributions. - ### Note for Ubuntu The libguestfs-tools package (needed for the guestmount command) does not work out of the box on Ubuntu. See https://github.com/firesim/firesim-software/issues/30 for a workaround. -## Python -This project was written for python 3.8. You can install all dependencies using: -``` -pip3 install -r python-requirements.txt -``` - -## Other Packages -FireMarshal depends on other open-source packages that can be installed by running: - -``` -./marshal-dependencies.sh -``` - -Note that this script downloads dependencies to a `dependencies` directory and installs them at the path pointed to by the `RISCV` environment variable. Thus, the script requires `RISCV` to be set (Chipyard/FireSim already do this). - -This script also updates submodules. - ## RISC-V Tools -In addition to standard libraries, you will need a RISC-V compatible toolchain, -the RISC-V isa simulator (spike). This is already installed by Chipyard/FireSim. +In addition to the dependencies installed above, you will need a RISC-V compatible toolchain, the RISC-V isa simulator (spike). This is already installed by Chipyard/FireSim. See the [Chipyard documentation](https://chipyard.readthedocs.io/en/latest/Chipyard-Basics/Initial-Repo-Setup.html#building-a-toolchain) for help setting up a known-good toolchain and environment. -## Qemu -Qemu is the default simulator used by FireMarshal and it currently installs v6.2.0. - # Basic Usage Building workloads: From f5f0a1db077723b82325289fcd2e71be91496648 Mon Sep 17 00:00:00 2001 From: Raghav Gupta Date: Sun, 24 Apr 2022 05:59:26 +0000 Subject: [PATCH 13/16] Updated docs for getting started section --- docs/source/gettingStarted.rst | 88 ++++++++++++++++++++++++++++++++++ docs/source/index.rst | 1 + 2 files changed, 89 insertions(+) create mode 100644 docs/source/gettingStarted.rst diff --git a/docs/source/gettingStarted.rst b/docs/source/gettingStarted.rst new file mode 100644 index 00000000..e0ec247d --- /dev/null +++ b/docs/source/gettingStarted.rst @@ -0,0 +1,88 @@ +.. _getting-started: + +Getting Started +==================== + +Setup +--------- + +The easiest way to use Marshal is to run it via Chipyard +(https://chipyard.readthedocs.io/en/latest/) or FireSim +(https://docs.fires.im/en/latest/). However, this is not required. + +Run the following script to install all of FireMarshal's dependencies +(standard packages from apt/yum, python libraries, open-source packages, +submodules): + +:: + + ./install/marshal-dependencies.sh + +Note that this script downloads dependencies to ``install/dependencies`` +and installs them at the path pointed to by the ``RISCV`` environment +variable. Thus, the script requires ``RISCV`` to be set and FireMarshal +expects ``PATH`` to contain the path it points to (Chipyard/FireSim +already do this). + +Running bare-metal workloads requires a minimal set of dependencies. You +can install just these by passing the ``-b`` flag as follows: + +:: + + ./install/marshal-dependencies.sh -b + +Note for Ubuntu +^^^^^^^^^^^^^^^^^^ + +The libguestfs-tools package (needed for the guestmount command) does +not work out of the box on Ubuntu. See +https://github.com/firesim/firesim-software/issues/30 for a workaround. + +RISC-V Tools +^^^^^^^^^^^^^^^ + +In addition to the dependencies installed above, you will need a RISC-V +compatible toolchain, the RISC-V isa simulator (spike). This is already +installed by Chipyard/FireSim. + +See the `Chipyard +documentation `__ +for help setting up a known-good toolchain and environment. + +Basic Usage +------------------ + +Building workloads: + +:: + + ./marshal build br-base.json + +To run in qemu: + +:: + + ./marshal launch br-base.json + +To install into FireSim (assuming you cloned this as a submodule of +FireSim or Chipyard): + +:: + + ./marshal install br-base.json + +Security Note +--------------------- + +Be advised that FireMarshal will run initialization scripts provided by +workloads. These scripts will have all the permissions your user has, be +sure to read all workloads carefully before building them. + +Getting Help / Discussion: +---------------------------- + +- For general questions, help, and discussion: use the FireSim user + forum: https://groups.google.com/forum/#!forum/firesim +- For bugs and feature requests: use the github issue tracker: + https://github.com/firesim/FireMarshal/issues +- See CONTRIBUTING.md for more details diff --git a/docs/source/index.rst b/docs/source/index.rst index a5b9e5a9..1f82e1fb 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -28,6 +28,7 @@ supported). :maxdepth: 3 :caption: Contents: + gettingStarted Tutorials/index commands workloadConfig From c78d62c9f9952663120cd762dd46bfbf8b9129a5 Mon Sep 17 00:00:00 2001 From: Raghav Gupta Date: Sun, 24 Apr 2022 06:14:28 +0000 Subject: [PATCH 14/16] Moved scripts to install directory + single script for complete installation --- .../centos-requirements.txt | 1 + gccwrap-centos => install/gccwrap-centos | 0 gccwrap-ubuntu => install/gccwrap-ubuntu | 0 .../marshal-dependencies.sh | 97 ++++++++++++++----- .../python-requirements.txt | 0 .../ubuntu-requirements.txt | 1 + 6 files changed, 73 insertions(+), 26 deletions(-) rename centos-requirements.txt => install/centos-requirements.txt (94%) rename gccwrap-centos => install/gccwrap-centos (100%) rename gccwrap-ubuntu => install/gccwrap-ubuntu (100%) rename marshal-dependencies.sh => install/marshal-dependencies.sh (75%) rename python-requirements.txt => install/python-requirements.txt (100%) rename ubuntu-requirements.txt => install/ubuntu-requirements.txt (96%) diff --git a/centos-requirements.txt b/install/centos-requirements.txt similarity index 94% rename from centos-requirements.txt rename to install/centos-requirements.txt index b4dfe2c9..c91bbf69 100644 --- a/centos-requirements.txt +++ b/install/centos-requirements.txt @@ -13,6 +13,7 @@ expat expat-devel glib-devel gtk2-devel +gtk3-devel ctags bc openssl-devel diff --git a/gccwrap-centos b/install/gccwrap-centos similarity index 100% rename from gccwrap-centos rename to install/gccwrap-centos diff --git a/gccwrap-ubuntu b/install/gccwrap-ubuntu similarity index 100% rename from gccwrap-ubuntu rename to install/gccwrap-ubuntu diff --git a/marshal-dependencies.sh b/install/marshal-dependencies.sh similarity index 75% rename from marshal-dependencies.sh rename to install/marshal-dependencies.sh index a2f58d4e..b99c54c2 100755 --- a/marshal-dependencies.sh +++ b/install/marshal-dependencies.sh @@ -3,13 +3,20 @@ # thanks to Giacomo Rizzi: some ideas have been taken from: https://github.com/gufoe/vuos-tutorial +bare_metal=0 + while getopts p: flag do case "${flag}" in p) prefix=${OPTARG};; + b) bare_metal=1;; esac done +INITWD=$(pwd) + +# switch to firemarshal/install dir +cd "$(dirname "$0")" BASE=$(pwd) echo "BASE: $BASE" @@ -38,13 +45,24 @@ function check_env { } function check_deps { - _=$(which python3.8) - if [ $? -ne 0 ] + + if [ $bare_metal -eq 1 ] && [ "$os" = "centos" ] then - echo "python3.8 not found" - exit 1 + _=$(which python3) + if [ $? -ne 0 ] + then + echo "python3 not found" + exit 1 + fi + else + _=$(which python3.8) + if [ $? -ne 0 ] + then + echo "python3.8 not found" + exit 1 + fi fi - + _=$(which unzip) if [ $? -ne 0 ] then @@ -61,9 +79,30 @@ function check_deps { } -check_env +function install_std { + if [ "$os" = "deb/ubuntu" ] + then + cat ubuntu-requirements.txt | sudo xargs apt-get install -y + elif [ "$os" = "centos" ] + then + if [ $bare_metal -eq 0 ] + then + sudo yum install -y centos-release-scl + sudo yum install -y rh-python38 + scl enable rh-python38 bash + fi + cat centos-requirements.txt | sudo xargs yum install -y + fi +} + +function install_pylibs { + pip3 install -r python-requirements.txt +} +check_env +install_std check_deps +instal_pylibs # User friendly messages on error set -E @@ -210,31 +249,37 @@ function install_qemu { # Start installation -rm -rf dependencies -mkdir dependencies - -if [ -z "$prefix" ] +if [ $bare_metal -eq 0 ] then - prefix=${RISCV} -fi + + rm -rf dependencies + mkdir dependencies -if [ -n "$prefix" ] -then - export PATH="$prefix:$prefix/bin:${PATH}" -fi + if [ -z "$prefix" ] + then + prefix=${RISCV} + fi + + install_cmake + install_ninja + install_meson + install_libslirp -install_cmake -install_ninja -install_meson -install_libslirp + install_repo https://github.com/virtualsquare/s2argv-execs/archive/refs/tags/1.3.tar.gz s2argv-execs + install_repo https://github.com/rd235/vdeplug4/archive/refs/tags/v4.0.1.tar.gz vdeplug4 + install_repo https://github.com/virtualsquare/libvdeslirp/archive/refs/tags/0.1.1.tar.gz libvdeslirp + install_repo https://github.com/virtualsquare/vdeplug_slirp/archive/refs/tags/0.1.0.tar.gz vdeplug_slirp -install_repo https://github.com/virtualsquare/s2argv-execs/archive/refs/tags/1.3.tar.gz s2argv-execs -install_repo https://github.com/rd235/vdeplug4/archive/refs/tags/v4.0.1.tar.gz vdeplug4 -install_repo https://github.com/virtualsquare/libvdeslirp/archive/refs/tags/0.1.1.tar.gz libvdeslirp -install_repo https://github.com/virtualsquare/vdeplug_slirp/archive/refs/tags/0.1.0.tar.gz vdeplug_slirp + install_qemu -install_qemu + cd .. && ./init-submodules.sh -./init-submodules.sh + + if [ "$os" = "centos" ] + then + sudo yum remove -y rm-python38-python + fi +fi echo 'Installation completed' +cd $INITWD diff --git a/python-requirements.txt b/install/python-requirements.txt similarity index 100% rename from python-requirements.txt rename to install/python-requirements.txt diff --git a/ubuntu-requirements.txt b/install/ubuntu-requirements.txt similarity index 96% rename from ubuntu-requirements.txt rename to install/ubuntu-requirements.txt index 4c22b093..b0f4b3d7 100644 --- a/ubuntu-requirements.txt +++ b/install/ubuntu-requirements.txt @@ -19,3 +19,4 @@ build-essential libssl-dev pkg-config wget +gettext From 34b7866a42dfbdc726eee1d865e694c389f55742 Mon Sep 17 00:00:00 2001 From: Nathan Pemberton Date: Tue, 26 Apr 2022 23:50:21 +0000 Subject: [PATCH 15/16] Switch to sourcing scl enable rather than using the scl command (it creates a subshell and messes everything up). This also refactors some stuff to make it simpler --- install/marshal-dependencies.sh | 105 ++++++++++---------------------- 1 file changed, 31 insertions(+), 74 deletions(-) diff --git a/install/marshal-dependencies.sh b/install/marshal-dependencies.sh index b99c54c2..2ef3a6f3 100755 --- a/install/marshal-dependencies.sh +++ b/install/marshal-dependencies.sh @@ -1,5 +1,5 @@ #!/bin/bash -#set -x +# set -x # thanks to Giacomo Rizzi: some ideas have been taken from: https://github.com/gufoe/vuos-tutorial @@ -20,89 +20,46 @@ cd "$(dirname "$0")" BASE=$(pwd) echo "BASE: $BASE" -function check_env { - if [ -z ${RISCV} ] - then - echo "RISCV environment variable NOT FOUND" - exit 1 - fi +if [ -z ${RISCV} ] +then + echo "RISCV environment variable NOT FOUND" + exit 1 +fi - _=$(which apt) +# Determine Ubuntu vs Centos +_=$(which apt) +if [ $? -eq 0 ] +then + os="deb/ubuntu" +else + _=$(which yum) if [ $? -eq 0 ] - then - os="deb/ubuntu" - else - _=$(which yum) - if [ $? -eq 0 ] - then - os="centos" - else - echo "yum/apt NOT FOUND" - exit 1 - fi - fi - -} - -function check_deps { - - if [ $bare_metal -eq 1 ] && [ "$os" = "centos" ] then - _=$(which python3) - if [ $? -ne 0 ] - then - echo "python3 not found" - exit 1 - fi - else - _=$(which python3.8) - if [ $? -ne 0 ] - then - echo "python3.8 not found" - exit 1 - fi - fi - - _=$(which unzip) - if [ $? -ne 0 ] - then - echo "unzip not found" - exit 1 - fi - - _=$(which wget) - if [ $? -ne 0 ] - then - echo "wget not found" + os="centos" + else + echo "yum/apt NOT FOUND" exit 1 fi +fi -} -function install_std { - if [ "$os" = "deb/ubuntu" ] - then - cat ubuntu-requirements.txt | sudo xargs apt-get install -y - elif [ "$os" = "centos" ] +echo -e "\nInstalling standard packages" +if [ "$os" = "deb/ubuntu" ] +then + cat ubuntu-requirements.txt | sudo xargs apt-get install -y +elif [ "$os" = "centos" ] +then + if [ $bare_metal -eq 0 ] then - if [ $bare_metal -eq 0 ] - then - sudo yum install -y centos-release-scl - sudo yum install -y rh-python38 - scl enable rh-python38 bash - fi - cat centos-requirements.txt | sudo xargs yum install -y + sudo yum install -y centos-release-scl + sudo yum install -y rh-python38 + source /opt/rh/rh-python38/enable fi -} - -function install_pylibs { - pip3 install -r python-requirements.txt -} + cat centos-requirements.txt | sudo xargs yum install -y +fi -check_env -install_std -check_deps -instal_pylibs +echo -e "\nInstalling python dependencies" +pip3 install --user -r python-requirements.txt # User friendly messages on error set -E From dc691370cdbe1b0d1cf45c40dd266caef9c8775e Mon Sep 17 00:00:00 2001 From: Raghav Gupta Date: Mon, 2 May 2022 06:05:53 +0000 Subject: [PATCH 16/16] fixed centos py38 issue + bug fix --- install/marshal-dependencies.sh | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/install/marshal-dependencies.sh b/install/marshal-dependencies.sh index 2ef3a6f3..eece72f6 100755 --- a/install/marshal-dependencies.sh +++ b/install/marshal-dependencies.sh @@ -49,12 +49,6 @@ then cat ubuntu-requirements.txt | sudo xargs apt-get install -y elif [ "$os" = "centos" ] then - if [ $bare_metal -eq 0 ] - then - sudo yum install -y centos-release-scl - sudo yum install -y rh-python38 - source /opt/rh/rh-python38/enable - fi cat centos-requirements.txt | sudo xargs yum install -y fi @@ -217,10 +211,26 @@ then prefix=${RISCV} fi + # vde packages need cmake >3.13 install_cmake + + # meson needs Python 3.8, not available on CentOS 7 w/o scl + if [ "$os" = "centos" ] + then + sudo yum install -y centos-release-scl + sudo yum install -y rh-python38 + source /opt/rh/rh-python38/enable + fi + install_ninja install_meson install_libslirp + + # we're done with meson + if [ "$os" = "centos" ] + then + sudo yum remove -y rh-python38-python + fi install_repo https://github.com/virtualsquare/s2argv-execs/archive/refs/tags/1.3.tar.gz s2argv-execs install_repo https://github.com/rd235/vdeplug4/archive/refs/tags/v4.0.1.tar.gz vdeplug4 @@ -230,12 +240,6 @@ then install_qemu cd .. && ./init-submodules.sh - - - if [ "$os" = "centos" ] - then - sudo yum remove -y rm-python38-python - fi fi echo 'Installation completed'