blob: b805ee70d5526b458d67a82a33c6c1faa5ec3786 (
plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
-include testenv/config.mk
TESTENV_IMAGE ?= kvmd-testenv
TESTENV_HID ?= /dev/ttyS10
TESTENV_VIDEO ?= /dev/video0
TESTENV_LOOP ?= /dev/loop7
TESTENV_CMD ?= /bin/bash
# =====
all:
cat Makefile
tox: _testenv
docker run --rm \
--volume `pwd`:/src:ro \
--volume `pwd`/testenv:/src/testenv:rw \
--volume `pwd`/extras:/usr/share/kvmd/extras:ro \
--volume `pwd`/configs:/usr/share/kvmd/configs.default:ro \
-it $(TESTENV_IMAGE) bash -c " \
cp /usr/share/kvmd/configs.default/kvmd/*.yaml /etc/kvmd \
&& cp /usr/share/kvmd/configs.default/kvmd/htpasswd /etc/kvmd \
&& cp /src/testenv/main.yaml /etc/kvmd \
&& cd /src \
&& tox -c testenv/tox.ini \
"
run:
make _run_app TESTENV_CMD="python -m kvmd.apps.kvmd"
run-cleanup:
make _run_app TESTENV_CMD="python -m kvmd.apps.cleanup"
run-no-cache:
make _run_app TESTENV_CMD="python -m kvmd.apps.kvmd" TESTENV_OPTS=--no-cache
shell:
make _run_app
shell-no-cache:
make _run_app TESTENV_OPTS=--no-cache
regen:
python3 genmap.py
release:
make clean
make tox
make clean
make push
make bump
make push
make clean
bump:
bumpversion minor
push:
git push
git push --tags
clean:
rm -rf build site dist pkg src v*.tar.gz *.pkg.tar.xz *.egg-info kvmd-*.tar.gz
find kvmd -name __pycache__ | xargs rm -rf
rm -rf __pycache__
make -C hid clean
clean-all: _testenv clean
- docker run --rm \
--volume `pwd`:/src \
-it $(TESTENV_IMAGE) bash -c "cd src && rm -rf testenv/{.tox,.mypy_cache,.coverage}"
_testenv:
docker build $(TESTENV_OPTS) --rm --tag $(TESTENV_IMAGE) -f testenv/Dockerfile .
_run_app: _testenv
sudo modprobe loop
- docker run --rm \
--volume `pwd`/kvmd:/kvmd:ro \
--volume `pwd`/web:/usr/share/kvmd/web:ro \
--volume `pwd`/extras:/usr/share/kvmd/extras:ro \
--volume `pwd`/configs:/usr/share/kvmd/configs.default:ro \
--volume `pwd`/testenv:/testenv:ro \
--device $(TESTENV_LOOP):/dev/kvmd-msd \
--device $(TESTENV_VIDEO):$(TESTENV_VIDEO) \
--publish 8080:80/tcp \
--publish 8081:8081/tcp \
--publish 8082:8082/tcp \
-it $(TESTENV_IMAGE) /bin/bash -c " \
(socat PTY,link=$(TESTENV_HID) PTY,link=/dev/ttyS11 &) \
&& cp -r /usr/share/kvmd/configs.default/nginx/* /etc/kvmd/nginx \
&& cp /usr/share/kvmd/configs.default/kvmd/*.yaml /etc/kvmd \
&& cp /usr/share/kvmd/configs.default/kvmd/htpasswd /etc/kvmd \
&& cp /testenv/main.yaml /etc/kvmd \
&& nginx -c /etc/kvmd/nginx/nginx.conf \
&& ln -s $(TESTENV_VIDEO) /dev/kvmd-video \
&& (losetup -d /dev/kvmd-msd || true) \
&& losetup /dev/kvmd-msd /root/loop.img \
&& $(TESTENV_CMD) \
"
- docker run --rm --device=$(TESTENV_LOOP):/dev/kvmd-msd -it $(TESTENV_IMAGE) losetup -d /dev/kvmd-msd
|