#!/bin/bash # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # $Source: src/build/hwpf/prcd_compile_test $ # # OpenPOWER HostBoot Project # # COPYRIGHT International Business Machines Corp. 2011,2014 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. See the License for the specific language governing # permissions and limitations under the License. # # IBM_PROLOG_END_TAG #Note that this test case assumes 3 files present in the PWD (along with prcd_compile.tcl) # - fapiTestHwp.C fapiTestHwp.H proc_cen_framelock.C # and 1 file in a subdirectory # dmi_training/proc_cen_framelock/proc_cen_framelock.H BUILD="b0218a_2012_Sprint9" ############################################################### # 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 if [ ! -f "./proc_cen_framelock.C" ]; then cp ../../usr/hwpf/hwp/dmi_training/proc_cen_framelock/proc_cen_framelock.H ./ check_good_rc $? fi if [ ! -f "./dmi_training/proc_cen_framelock/proc_cen_framelock.H" ]; then mkdir -p dmi_training/proc_cen_framelock cp ../../usr/hwpf/hwp/dmi_training/proc_cen_framelock/proc_cen_framelock.H ./dmi_training/proc_cen_framelock check_good_rc $? fi echo echo "TEST - Good Path - Multi Process" { ./prcd_compile.tcl -d $BUILD -o out1 ./fapiTestHwp.H; check_good_rc_and_bin $? ./out1; } & sleep 2 { ./prcd_compile.tcl -d $BUILD -o out2 ./fapiTestHwp.C; check_good_rc_and_bin $? ./out2; } & sleep 2 { ./prcd_compile.tcl -d $BUILD -o out3 ./fapiTestHwp.H ./fapiTestHwp.C; check_good_rc_and_bin $? ./out3; } & wait 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 ./proc_cen_framelock.C ./fapiTestHwp.C check_good_rc_and_bin $? ./ echo echo "TEST - Good Path - buried File" ./prcd_compile.tcl -d $BUILD ./dmi_training/proc_cen_framelock/proc_cen_framelock.H check_good_rc_and_bin $? ./ 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 - New working HWP" cat >> mss_compile_test.C << EOF #include #include fapi::ReturnCode mss_compile_test(std::vector & i_targets_memb) { fapi::ReturnCode l_rc; return l_rc; } EOF cat >> mss_compile_test.H << EOF #ifndef MSS_COMPILE_TESTHWPB_H_ #define MSS_COMPILE_TESTHWPB_H_ #include typedef fapi::ReturnCode (*mss_comile_test_FP_t)(std::vector &); extern "C" { fapi::ReturnCode mss_comile_test(std::vector & l_targets_memb); } #endif EOF ./prcd_compile.tcl -n mss_compile_test.C mss_compile_test.H check_good_rc $? echo echo "TEST - New working HWP - missing .H file" ./prcd_compile.tcl -n mss_compile_test.C check_bad_rc $? echo echo "TEST - Good Path - Compile Failure" echo COMPILE_FAIL >> fapiTestHwp.H ./prcd_compile.tcl -d $BUILD fapiTestHwp.H fapiTestHwp.C check_bad_rc $?