summaryrefslogtreecommitdiffstats
path: root/src/build/hwpf/prcd_compile_test
blob: 5f89cca694d58c7c406df6e767d15791e33bbfe1 (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/bash
#  IBM_PROLOG_BEGIN_TAG
#  This is an automatically generated prolog.
#
#  $Source: src/build/hwpf/prcd_compile_test $
#
#  IBM CONFIDENTIAL
#
#  COPYRIGHT International Business Machines Corp. 2011
#
#  p1
#
#  Object Code Only (OCO) source materials
#  Licensed Internal Code Source Materials
#  IBM HostBoot Licensed Internal Code
#
#  The source code for this program is not published or other-
#  wise divested of its trade secrets, irrespective of what has
#  been deposited with the U.S. Copyright Office.
#
#  Origin: 30
#
#  IBM_PROLOG_END

#Note that this test case assumes 2 files present in the PWD (along with prcd_compile.tcl)
# - fapiTestHwp.C and fapiTestHwp.H

BUILD="b1109a_2011_Sprint6"

###############################################################
# Validate return code, exit on failure
###############################################################
function check_good_rc {

    if [ $1 -eq 0 ]; then
        echo SUCCESS
        echo
    else
        echo FAIL: Bad RC Returned:$1; exit -1
    fi
}

###############################################################
# Validate return code and that binary was generated, exit on failure
###############################################################
function check_good_rc_and_bin {

    if [ -f $2/hbicore.bin ] && [ -f $2/hbicore_extended.bin ] && [ -f $2/hbotStringFile ]; then
        check_good_rc $1        
        rm -f $2/hbicore*    
        rm -f $2/*.bin
        rm -f $2/hbotStringFile
    else
        echo FAIL: Missing File; exit -1
    fi
}

###############################################################
# Validate return code is non-zero, exit on failure
###############################################################
function check_bad_rc {

    if [ $1 -ne 0 ]; then
        echo SUCCESS
        echo
    else
        echo FAIL; exit -1
    fi
}

###############################################################
# Main
###############################################################

# Check if the needed files exist, if not try and copy them in
if [ ! -f "./fapiTestHwp.H" ]; then
    cp ../../include/usr/hwpf/hwp/fapiTestHwp.H ./
    check_good_rc $?
fi

if [ ! -f "./fapiTestHwp.C" ]; then
    cp ../../usr/hwpf/hwp/fapiTestHwp.C ./
    check_good_rc $?
fi

if [ ! -f "./sample.initfile" ]; then
    cp ../../usr/hwpf/hwp/initfiles/sample.initfile ./
    check_good_rc $?
fi

echo 

echo "TEST - Good Path - Multi Process"
./prcd_compile.tcl -d $BUILD ./fapiTestHwp.H ./fapiTestHwp.C &
sleep 2
./prcd_compile.tcl -d $BUILD ./fapiTestHwp.H ./fapiTestHwp.C &
sleep 2
./prcd_compile.tcl -d $BUILD ./fapiTestHwp.H ./fapiTestHwp.C &
sleep 20

echo
echo "TEST - Good Path - 1 C File"
./prcd_compile.tcl -d $BUILD ./fapiTestHwp.C
check_good_rc_and_bin $? ./

echo
echo "TEST - Good Path - 1 H File with -o Param"
./prcd_compile.tcl -d $BUILD -o ./ ./fapiTestHwp.H
check_good_rc_and_bin $? ./

echo
echo "TEST - Good Path - 2 Files"
./prcd_compile.tcl -d $BUILD ./fapiTestHwp.H ./fapiTestHwp.C
check_good_rc_and_bin $? ./

echo
echo "TEST - Good Path - Directory Path and Output Directory"
cp fapiTestHwp.H /tmp/
./prcd_compile.tcl -d $BUILD -o ./output/ /tmp/fapiTestHwp.H fapiTestHwp.C
check_good_rc_and_bin $? ./output/
rm /tmp/fapiTestHwp.H

echo
echo "TEST - Good Path - No Files"
./prcd_compile.tcl -d $BUILD
check_good_rc_and_bin $? ./

echo
echo "TEST - Good Path - Initfile"
./prcd_compile.tcl -o ./output/ sample.initfile
check_good_rc_and_bin $? ./output/

echo
echo "TEST - Good Path - All Files"
./prcd_compile.tcl -o ./output/ sample.initfile fapiTestHwp.H ./fapiTestHwp.C
check_good_rc_and_bin $? ./output/

echo
echo "TEST - Bad Path - Compile Failure" 
cp fapiTestHwp.H /tmp/
echo COMPILE_FAIL >> /tmp/fapiTestHwp.H
./prcd_compile.tcl -d $BUILD /tmp/fapiTestHwp.H fapiTestHwp.C
check_bad_rc $?
rm *.bin
rm /tmp/fapiTestHwp.H

OpenPOWER on IntegriCloud