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