This file is indexed.

/usr/lib/plainbox-providers-1/checkbox/bin/storage_test is in plainbox-provider-checkbox 0.3-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash

# take the path of the storage device and test is it a block device.

function run_bonnie() {
    echo "Running bonnie++ on $1..."
    mount_point=$(df -h | grep -m 1 $1 | awk '{print $6}')
    echo "Putting scratch disk at $mount_point"
    mkdir -p "$mount_point/tmp/scratchdir"
    
    # When running on disks with small drives (SSD/flash) we need to do
    # some tweaking. Bonnie uses 2x RAM by default to write data. If that's 
    # more than available disk space, the test will fail inappropriately.
    free_space=$(df -m | grep -m 1 $1 | awk '{print $4}')
    echo "    Disk $1 has ${free_space}MB available"
    memory=$(free -m |grep Mem|awk '{print $2}')
    echo "    System has ${memory}MB RAM"
    disk_needed=$((memory * 2))
    echo "    We need ${disk_needed}MB of disk space for testing"
    if [[ "$disk_needed" -ge "$free_space" ]]; then
        echo "    Insufficient disk space available for defaults."
        echo "    reducing memory footprint to be 1/2 of free disk space."
        # we need to pass an amount that's 1/2 the amount of available disk
        # space to bonnie++ so she doesn't overwrite and fail.
        disk_needed=$(($free_space/2))
        bonnie++ -d $mount_point/tmp/scratchdir -u root -r $disk_needed
    else
        echo "   Free disk space is sufficient to continue testing."
        bonnie++ -d $mount_point/tmp/scratchdir -u root
    fi
}

disk=/dev/$1

if [ -b $disk ]
then
    echo "$disk is a block device"
    size=`parted -l -s | grep $disk | awk '{print $3}'`

    if [ -n "$size" ]
    then
        echo "$disk reports a size of $size."
        # Have to account for the end of the size descriptor
        size_range=${size:(-2)}
	
        if mount | grep -q $disk
        then
            echo "$disk is mounted, proceeding."
        else
            echo "$disk is not mounted. It must be mounted before testing."
            exit 1
        fi


        if [ $size_range == "KB" ]
        then
            echo "$disk is too small to be functioning."
            exit 1
        elif [ $size_range == "MB" ]
        then
            size_int=${size::${#size}-2}

            if [ $size_int -gt 10 ]
            then
                run_bonnie $disk
            else
                echo "$disk is too small to be functioning."
                exit 1
            fi
        else
            run_bonnie $disk
        fi
    else
       echo "$disk doesn't report a size."
       exit 1
    fi
else
    echo "$disk is not listed as a block device."
    exit 1
fi