xref: /aosp_15_r20/kernel/tests/net/test/rootfs/net_test.sh (revision 2f2c4c7ab4226c71756b9c31670392fdd6887c4f)
1*2f2c4c7aSAndroid Build Coastguard Worker#!/bin/bash
2*2f2c4c7aSAndroid Build Coastguard Worker#
3*2f2c4c7aSAndroid Build Coastguard Worker# Copyright (C) 2018 The Android Open Source Project
4*2f2c4c7aSAndroid Build Coastguard Worker#
5*2f2c4c7aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License");
6*2f2c4c7aSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License.
7*2f2c4c7aSAndroid Build Coastguard Worker# You may obtain a copy of the License at
8*2f2c4c7aSAndroid Build Coastguard Worker#
9*2f2c4c7aSAndroid Build Coastguard Worker#      http://www.apache.org/licenses/LICENSE-2.0
10*2f2c4c7aSAndroid Build Coastguard Worker#
11*2f2c4c7aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
12*2f2c4c7aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS,
13*2f2c4c7aSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*2f2c4c7aSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and
15*2f2c4c7aSAndroid Build Coastguard Worker# limitations under the License.
16*2f2c4c7aSAndroid Build Coastguard Worker#
17*2f2c4c7aSAndroid Build Coastguard Worker
18*2f2c4c7aSAndroid Build Coastguard Workerset -e
19*2f2c4c7aSAndroid Build Coastguard Workerset -u
20*2f2c4c7aSAndroid Build Coastguard Worker
21*2f2c4c7aSAndroid Build Coastguard Workermount -t proc none /proc
22*2f2c4c7aSAndroid Build Coastguard Workermount -t sysfs none /sys
23*2f2c4c7aSAndroid Build Coastguard Workermount -t tmpfs tmpfs /tmp
24*2f2c4c7aSAndroid Build Coastguard Workermount -t tmpfs tmpfs /run
25*2f2c4c7aSAndroid Build Coastguard Worker
26*2f2c4c7aSAndroid Build Coastguard Worker# If this system was booted under UML, it will always have a /proc/exitcode
27*2f2c4c7aSAndroid Build Coastguard Worker# file. If it was booted natively or under QEMU, it will not have this file.
28*2f2c4c7aSAndroid Build Coastguard Workerif [[ -e /proc/exitcode ]]; then
29*2f2c4c7aSAndroid Build Coastguard Worker  mount -t hostfs hostfs /host
30*2f2c4c7aSAndroid Build Coastguard Workerelse
31*2f2c4c7aSAndroid Build Coastguard Worker  mount -t 9p -o trans=virtio,version=9p2000.L host /host
32*2f2c4c7aSAndroid Build Coastguard Workerfi
33*2f2c4c7aSAndroid Build Coastguard Worker
34*2f2c4c7aSAndroid Build Coastguard Workertest="$(sed -r 's/.*net_test=([^ ]*).*/\1/g' < /proc/cmdline)"
35*2f2c4c7aSAndroid Build Coastguard Workercd "$(dirname "${test}")"
36*2f2c4c7aSAndroid Build Coastguard Worker./net_test.sh
37*2f2c4c7aSAndroid Build Coastguard Workerpoweroff -f
38