summaryrefslogtreecommitdiffstats
path: root/kernel/standards/usex/runtest.sh
blob: be6fc5e7005bd51d3563f84fa1b9681c8fcd9bf1 (plain)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/sh

function SysStats()
{
    # Collect some stats prior to running the test
    echo "***** System stats *****"
    vmstat
    echo "---"
    free -m
    echo "---"
    cat /proc/meminfo
    echo "---"
    cat /proc/slabinfo
    echo "***** System stats *****"
}

function VerboseCupsLog()
{
   # This funnction was added Nov 2010 in hopes of assisting in resoltion of bugzilla 452305
   # See comment #31 https://bugzilla.redhat.com/show_bug.cgi?id=452305
   # Provide more verbose debug logging in /var/log/cups/error_log  
   echo "-------------------------------------------------------------------------"
   echo "Setting up verbose debug logging in /var/log/cups/error_log for BZ452305."
   echo "-------------------------------------------------------------------------"
   rstrnt-backup /etc/cups/cupsd.conf
   sed -i -e 's,^LogLevel.*,LogLevel debug2,' /etc/cups/cupsd.conf
   sed -i -e '/^MaxLogSize/d' /etc/cups/cupsd.conf
   echo MaxLogSize 0 >> /etc/cups/cupsd.conf
   sed -i -e '/^Browsing/d' /etc/cups/cupsd.conf
   sed -i -e '/^DefaultShared/d' /etc/cups/cupsd.conf
   echo "Browsing No" >> /etc/cups/cupsd.conf
   echo "DefaultShared No" >> /etc/cups/cupsd.conf
   # sed will create temporary file in /etc/cups and rename it to cupds.conf
   # so file ends up with wrong label
   restorecon /etc/cups/cupsd.conf
   # start service before using cupsctl
   /sbin/service cups restart
   echo "cupsctl: "
   cupsctl
}

# ---------- Build UseX -------------

tar zxvf usex-1.9-34.tar.gz
pushd usex-1.9-34 && make || exit 1

# ---------- Start Test -------------
RHELVER=""
cat /etc/redhat-release | grep "^Fedora"
if [ $? -ne 0 ]; then
    RHELVER=$(cat /etc/redhat-release |sed 's/.*\(release [0-9]\).*/\1/')
fi

if [ -z "$RHELVER" ]; then
    kernel_rhelver=$(uname -r | grep -o el[0-9])
    echo "Taking release from kernel version: $kernel_rhelver"

    if [ "$kernel_rhelver" == "el6" ]; then
        RHELVER="release 6"
    fi

    if [ "$kernel_rhelver" == "el7" ]; then
        RHELVER="release 7"
    fi
fi

echo "RHELVER is $RHELVER"

VerboseCupsLog

INFILE=../rhtsusex.tcf
MYARCH=`uname -m`
if [ "$MYARCH" = "x86_64" -o "$MYARCH" = "s390x" ]; then
    ln -s /usr/lib64/libc.a /usr/lib/libc.a
fi

#if ppc64 has less than or equal to 1 GB of memory don't run the vm tests
ONE_GB=1048576
if [ "$MYARCH" = "ppc64" ]; then
    mem=`cat /proc/meminfo |grep MemTotal|sed -e 's/[^0-9]*\([0-9]*\).*/\1/'`
    test "$mem" -le "$ONE_GB" && INFILE=../rhtsusex_lowmem.tcf
    logger -s "Running the rhtsusex_lowmem.tcf file"
fi

SysStats | tee sys_stats.log
logger -t USEXINFO -f sys_stats.log

if [ "x$RHELVER" == "xrelease 6" ]; then
    logger -s "Running $RHELVER configuration"
    ./usex --rhts hang-trace --exclude=ar,strace,clear -i $INFILE -l usex.log --nodisplay -R report.out
elif [ "x$RHELVER" == "xrelease 7" ]; then
    logger -s "Running $RHELVER configuration"
    ./usex --rhts hang-trace --exclude=ar,as,strace,clear -i $INFILE -l usex.log --nodisplay -R report.out
else
    logger -s "Running default configuration"
    ./usex --rhts hang-trace --exclude=clear -i $INFILE -l usex.log --nodisplay -R report.out
fi

# Default result to FAIL
export result="FAIL"

# Then post-process the results to find the regressions
export fail=`cat report.out | grep "USEX TEST RESULT: FAIL" | wc -l`

if [ "$fail" -gt "0" ]; then
    export result="FAIL"
    rstrnt-report-log -l report.out
    tar -czvf /tmp/cupslog.tar /var/log/cups
    rstrnt-report-log -l /tmp/cupslog.tar
    rstrnt-report-log -l /etc/cups/cupsd.conf
else
    export result="PASS"
fi

rstrnt-report-result $RSTRNT_TASKNAME $result $fail
rstrnt-report-log -l usex.log