Skip to content

Commit 7434d1f

Browse files
lcolittiGerrit Code Review
authored andcommitted
Merge "Allow run_net_test.sh to use a pre-existing kernel binary."
2 parents c0bc556 + a9fe6b7 commit 7434d1f

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

tests/net_test/run_net_test.sh

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,39 +66,43 @@ for tap in $tapinterfaces; do
6666
fi
6767
done
6868

69-
# Exporting ARCH=um SUBARCH=x86_64 doesn't seem to work, as it "sometimes" (?)
70-
# results in a 32-bit kernel.
69+
if [ -z "$KERNEL_BINARY" ]; then
70+
# Exporting ARCH=um SUBARCH=x86_64 doesn't seem to work, as it "sometimes"
71+
# (?) results in a 32-bit kernel.
7172

72-
# If there's no kernel config at all, create one or UML won't work.
73-
[ -f .config ] || make defconfig ARCH=um SUBARCH=x86_64
73+
# If there's no kernel config at all, create one or UML won't work.
74+
[ -f .config ] || make defconfig ARCH=um SUBARCH=x86_64
7475

75-
# Enable the kernel config options listed in $OPTIONS.
76-
cmdline=${OPTIONS// / -e }
77-
./scripts/config $cmdline
76+
# Enable the kernel config options listed in $OPTIONS.
77+
cmdline=${OPTIONS// / -e }
78+
./scripts/config $cmdline
7879

79-
# Disable the kernel config options listed in $DISABLE_OPTIONS.
80-
cmdline=${DISABLE_OPTIONS// / -d }
81-
./scripts/config $cmdline
80+
# Disable the kernel config options listed in $DISABLE_OPTIONS.
81+
cmdline=${DISABLE_OPTIONS// / -d }
82+
./scripts/config $cmdline
8283

83-
# olddefconfig doesn't work on old kernels.
84-
if ! make olddefconfig ARCH=um SUBARCH=x86_64 CROSS_COMPILE= ; then
85-
cat >&2 << EOF
84+
# olddefconfig doesn't work on old kernels.
85+
if ! make olddefconfig ARCH=um SUBARCH=x86_64 CROSS_COMPILE= ; then
86+
cat >&2 << EOF
8687
8788
Warning: "make olddefconfig" failed.
8889
Perhaps this kernel is too old to support it.
8990
You may get asked lots of questions.
9091
Keep enter pressed to accept the defaults.
9192
9293
EOF
94+
fi
95+
96+
# Compile the kernel.
97+
make -j32 linux ARCH=um SUBARCH=x86_64 CROSS_COMPILE=
98+
KERNEL_BINARY=./linux
9399
fi
94100

95-
# Compile the kernel.
96-
make -j32 linux ARCH=um SUBARCH=x86_64 CROSS_COMPILE=
97101

98102
# Get the absolute path to the test file that's being run.
99103
dir=/host$(dirname $(readlink -f $0))
100104

101105
# Start the VM.
102-
exec ./linux umid=net_test ubda=$(dirname $0)/$ROOTFS \
106+
exec $KERNEL_BINARY umid=net_test ubda=$(dirname $0)/$ROOTFS \
103107
mem=512M init=/sbin/net_test.sh net_test=$dir/$test \
104108
$netconfig

0 commit comments

Comments
 (0)