f816b80c3db96e1ef779d7216ad78456b2f972e2
[platform/upstream/cryptsetup.git] / tests / 00modules-test
1 #!/bin/bash
2
3 [ -z "$CRYPTSETUP_PATH" ] && CRYPTSETUP_PATH=".."
4
5 function pversion() {
6         if [ ! -x $CRYPTSETUP_PATH/$1 ] ; then
7                 return
8         fi
9
10         echo -n "$CRYPTSETUP_PATH/"
11         $CRYPTSETUP_PATH/$1 --version
12 }
13
14 echo "Cryptsetup test environment ($(date))"
15 uname -a
16 if [ "$(cat /proc/sys/crypto/fips_enabled 2>/dev/null)" = "1" ] ; then
17         echo "Kernel running in FIPS mode."
18 fi
19
20 if [ -f /etc/os-release ] ; then
21         source /etc/os-release
22         echo "$PRETTY_NAME ($NAME) $VERSION"
23 fi
24
25 echo "Memory"
26 free -m
27
28 pversion cryptsetup
29 pversion veritysetup
30 pversion integritysetup
31
32 [ -x $CRYPTSETUP_PATH/cryptsetup ] && {
33         echo -e "Cryptsetup defaults:"
34         $CRYPTSETUP_PATH/cryptsetup --help | sed -n '/optional key file for/,$p' | tail -n +3
35 }
36
37 [ $(id -u) != 0 ] && exit 77
38
39 modprobe dm-crypt     >/dev/null 2>&1
40 modprobe dm-verity    >/dev/null 2>&1
41 modprobe dm-integrity >/dev/null 2>&1
42 modprobe dm-zero      >/dev/null 2>&1
43
44 dmsetup version
45
46 echo "Device mapper targets:"
47 dmsetup targets
48
49 exit 0