-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
187 lines (139 loc) · 6.14 KB
/
Makefile
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
LINUXCONFIG ?= linux.config
# LINUXCONFIG ?= linux-cov.config
# LINUXCONFIG ?= linux-fast.config
# LINUXCONFIG ?= linux-fasttrace.config
# LINUXCONFIG ?= linux-nosmp.config
ifdef SHALLOW_CLONE
DEPTH ?= --depth 1
endif
all: kernel rootfs iperf
setup:
([ -d buildroot ] || [ -h buildroot ]) || git clone $(DEPTH) git://git.buildroot.net/buildroot buildroot -b 2023.11.1
([ -d iproute2 ] || [ -h iproute2 ]) || git clone $(DEPTH) https://github.com/LabNConsulting/iptfs-iproute2.git iproute2 -b iptfs
([ -d linux ] || [ -h linux ]) || git clone $(DEPTH) https://github.com/LabNConsulting/iptfs-linux.git linux -b iptfs
kernel: output-linux/arch/x86/boot/bzImage
warn-kernel-log.txt: output-linux
cp $(LINUXCONFIG) output-linux/.config
make -k -C linux -j$(shell nproc) V=1 C=1 W=1 O=../output-linux LOCALVERSION='' > $@ 2>&1 || true
grep -q " CC" $@ # make sure it tried to compile since we ignore errors
# Filter out existing non-iptfs warnings with egrep
test-warn-kernel: warn-kernel-log.txt
COUNT=$$(egrep -v -f check-ignore-warning.txt $< | egrep -c warning:); echo count=$$COUNT; test $$COUNT = 0;
test-warn-range:
MERGE_BASE=$$(cd linux && git merge-base upstream/master iptfs); \
FIRST_COMMIT=$$(cd linux && git rev-list $$MERGE_BASE..iptfs | tail -n 1); \
(cd linux && git-for-each.py --start=$$FIRST_COMMIT --end=iptfs -- bash -c 'make -C .. test-warn-kernel && mv ../warn-kernel-log.txt ../warn-kernel-log-$$SHA.txt')
test-build-range:
MERGE_BASE=$$(cd linux && git merge-base upstream/master iptfs); \
FIRST_COMMIT=$$(cd linux && git rev-list $$MERGE_BASE..iptfs | tail -n 1); \
(cd linux && git-for-each.py --start=$$FIRST_COMMIT --end=iptfs -- bash -c 'make -C .. kernel > ../build-log.txt && mv ../build-log.txt ../build-log-$$SHA.txt')
test-all-config-range:
MERGE_BASE=$$(cd linux && git merge-base upstream/master iptfs); \
FIRST_COMMIT=$$(cd linux && git rev-list $$MERGE_BASE..iptfs | tail -n 1); \
TEST_OUTPUT_DIR=../output-test; \
(cd linux && git-for-each.py --start=$$FIRST_COMMIT --end=iptfs -- ../scripts/test-build.sh)
# kernel: linux/arch/x86/boot/bzImage
rootfs: output-buildroot/images/rootfs.cpio.gz
# These aren't phoney but we always want to descend to check them with make
# .PHONY: linux/arch/x86/boot/bzImage output-buildroot/images/rootfs.cpio.gz
.PHONY: output-linux/arch/x86/boot/bzImage output-buildroot/images/rootfs.cpio.gz
linux-defconfig:
make -C linux O=../output-linux defconfig
linux-menuconfig:
make -C linux O=../output-linux menuconfig
linux-allyesconfig:
make -C linux O=../output-linux allyesconfig
linux-allmodconfig:
make -C linux O=../output-linux allmodconfig
br-defconfig:
make -C buildroot O=../output-buildroot defconfig
br-menuconfig:
make -C buildroot O=../output-buildroot menuconfig
output-linux/arch/x86/boot/bzImage: output-linux output-linux/.config
mkdir -p output-linux
make -C linux -j$(shell nproc) O=../output-linux LOCALVERSION=''
(cd linux && scripts/clang-tools/gen_compile_commands.py -d../output-linux)
# linux/arch/x86/boot/bzImage: linux/.config
# make -C linux -j$(shell nproc)
# (cd linux && scripts/clang-tools/gen_compile_commands.py)
output-buildroot/images/rootfs.cpio.gz: output-buildroot output-buildroot/.config
mkdir -p output-buildroot
make -C buildroot -j$(shell nproc) V=1 O=../output-buildroot LOCALVERSION=''
output-linux/.config: $(LINUXCONFIG)
cp -p $< $@
output-buildroot/.config: buildroot.config
cp -p $< $@
output-buildroot output-iperf3 output-linux:
mkdir -p $@
# local iperf
iperf: iperf3 output-iperf3/src/iperf3
iperf3:
([ -d iperf ] || [ -h iperf ]) || git clone $(DEPTH) https://github.com/LabNConsulting/iperf.git iperf3 -b imix
(cd iperf3 && git pull --rebase)
iperf3/configure: iperf3/configure.ac
(cd iperf3 && ./bootstrap.sh)
output-iperf3/Makefile: iperf3/configure
mkdir -p output-iperf3
(cd output-iperf3 && ../iperf3/configure --enable-static-bin)
output-iperf3/src/iperf3: output-iperf3/Makefile
(cd output-iperf3 && make -j$(nproc))
#
# Testing
#
tests/ci: iperf
sudo -E pytest -s tests/config tests/errors tests/frags tests/simplenet tests/utpkt/test_utpkt.py
tests-trex/external_libs:
scripts/extract-trex.sh
clean-trex:
rm -rf tests-trex/podman-trex-extract tests-trex/trex tests-trex/trex_stl_lib tests-trex/external_libs
test: iperf tests-trex/external_libs
sudo -E pytest -s tests
sudo -E pytest -s tests-trex
#
# CI Rules
#
ci-extract-cov:
bash scripts/extract-cov.sh
mkdir -p test-logs
cp *.info test-logs
#
# Personal
#
# PERFTEST := tests/stress/test_stress_phy.py::test_policy_small_pkt
# PERFSLAB := tests.stress.test_stress_phy
#PERFFILE := ./res-latest/$(PERFSLAB)/r1/perf-0.data
# PERFTEST := tests/iperf/test_iperf_phy.py::test_iperf[False-False-False-88-]
# PERFSLAB := tests.iperf.test_iperf_phy
PERFTEST := tests/iperf/test_iperf_phy.py::test_iperf[False-False-False-None-]
PERFSLAB := $(subst /,.,$(shell SLAB=$(PERFTEST); echo $${SLAB%.py*}))
PERFPFX := /tmp/unet-test/$(PERFSLAB)
PERFFILES := $(PERFPFX)/r1/perf-0.data $(PERFPFX)/r2/perf-0.data
PERFBIN := ../output-buildroot/target/usr/bin/perf
flame-clean:
sudo rm -f $(PERFPFX)/perf-*.data $(PERFPFX)/perf-*.fdata flame-r1.svg flame-r2.svg $(PERFFILES)
flame: iperf flame-r1.svg flame-r2.svg
scp flame.svg ja:
$(PERFFILES):
sudo -E pytest -s -v '$(PERFTEST)' --enable-physical --profile || true
FlameGraph:
git clone https://github.com/brendangregg/FlameGraph
$(PERFPFX)/perf-%.data: $(PERFPFX)/%/perf-0.data
sudo chown $(USER) $(PERFPFX)
(cd FlameGraph && $(PERFBIN) script --vmlinux ../output-linux/vmlinux -i $< > $@)
$(PERFPFX)/perf-%.fdata: $(PERFPFX)/perf-%.data
sudo chown $(USER) $(PERFPFX)
(cd FlameGraph && ./stackcollapse-perf.pl $< > $@)
flame-%.svg: $(PERFPFX)/perf-%.fdata
(cd FlameGraph && ./flamegraph.pl --height=16 --fontsize=6 $< > ../$@)
#
# Making and sending patches
#
#
# V=6; git format-patch -v$V --subject-prefix="RFC ipsec-next" -o ../patches/v$V/ upstream/master..origin/iptfs
#
# for f in ../patches/v$V/v$V-*; do echo ====$f====; scripts/checkpatch.pl --ignore=AVOID_BUG $f; done
#
# git send-email --cc='Steffen Klassert <steffen.klassert@secunet.com>' \
# --cc='netdev@vger.kernel.org' --to='devel@linux-ipsec.org' \
# --cc='chopps@chopps.org' ../patches/v$V \
#