]> git.proxmox.com Git - mirror_lxc.git/blob - src/tests/lxc-test-procsys
oss-fuzz: adapt options to oss-fuzz build
[mirror_lxc.git] / src / tests / lxc-test-procsys
1 #!/bin/bash
2
3 # lxc: linux Container library
4
5 # Authors:
6 # Motiejus Jakštys <motiejus@jakstys.lt>
7 #
8 # Ensure that when /proc and/or /sys do not exist in the container,
9 # it is started successfully anyway.
10
11 # This library is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU Lesser General Public
13 # License as published by the Free Software Foundation; either
14 # version 2.1 of the License, or (at your option) any later version.
15
16 # This library is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 # Lesser General Public License for more details.
20
21 # You should have received a copy of the GNU Lesser General Public
22 # License along with this library; if not, write to the Free Software
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24
25 set -ex
26 FAIL() {
27 echo -n "Failed " >&2
28 echo "$*" >&2
29 lxc-destroy -n lxc-test-procsys -f
30 exit 1
31 }
32
33 lxc-destroy -n lxc-test-procsys -f || :
34 lxc-create -t busybox -n lxc-test-procsys
35 rmdir /var/lib/lxc/lxc-test-procsys/rootfs/{proc,sys}
36
37 lxc-start -n lxc-test-procsys
38 lxc-wait -n lxc-test-procsys -s RUNNING || FAIL "waiting for busybox container to run"
39
40 lxc-attach -n lxc-test-procsys -- sh -c 'test -f /proc/version' || FAIL "/proc/version not found"
41 lxc-attach -n lxc-test-procsys -- sh -c 'test -d /sys/fs' || FAIL "/sys/fs not found"
42
43 lxc-destroy -n lxc-test-procsys -f
44 exit 0