-
Notifications
You must be signed in to change notification settings - Fork 20
/
do-python3
executable file
·76 lines (67 loc) · 2.11 KB
/
do-python3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# https://stackoverflow.com/a/246128/4804196
SOURCE=${BASH_SOURCE[0]}
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
SOURCE=$(readlink "$SOURCE")
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
SCRIPT_DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
source "$SCRIPT_DIR"/../include/base
app="$top"/apps/app-python3
source "$SCRIPT_DIR"/../include/common_functions
setup_app()
{
if ! test -d "$app"; then
git clone https://github.com/unikraft/app-python3 "$app"
fi
}
run()
{
if test ! -d "$app"; then
echo "$app folder doesn't exist. Did you run '$0 setup'?" 1>&2
exit 1
fi
pushd "$app" > /dev/null
export UK_WORKDIR=$(pwd)/../../
kraft run -M 1024 " -- helloworld.py"
popd > /dev/null
}
run_qemu()
{
if test ! -d "$app"; then
echo "$app folder doesn't exist. Did you run '$0 setup'?" 1>&2
exit 1
fi
pushd "$app" > /dev/null
sudo qemu-system-x86_64 \
-kernel build/python3_kvm-x86_64 \
-cpu host \
-m 1G \
-enable-kvm \
-fsdev local,id=myid,path=$(pwd)/fs0,security_model=none \
-device virtio-9p-pci,fsdev=myid,mount_tag=fs0,disable-modern=on,disable-legacy=off \
-append " -- helloworld.py" \
-nographic
popd > /dev/null
}
run_debug()
{
if test ! -d "$app"; then
echo "$app folder doesn't exist. Did you run '$0 setup'?" 1>&2
exit 1
fi
pushd "$app" > /dev/null
sudo qemu-system-x86_64 \
-kernel build/python3_kvm-x86_64.dbg \
-cpu host \
-m 1G \
-enable-kvm \
-fsdev local,id=myid,path=$(pwd)/fs0,security_model=none \
-device virtio-9p-pci,fsdev=myid,mount_tag=fs0,disable-modern=on,disable-legacy=off \
-append " -- helloworld.py" \
-nographic \
-gdb tcp::1234 -S
popd > /dev/null
}
source "$SCRIPT_DIR"/../include/common_command