summaryrefslogtreecommitdiffstats
path: root/src/build/hwpf
diff options
context:
space:
mode:
authorBrian Horton <brianh@linux.ibm.com>2012-02-21 15:48:56 -0600
committerBrian H. Horton <brianh@linux.ibm.com>2012-02-27 13:23:49 -0600
commit8c9986ad90d1ff17af4d8768c83beb526b03626c (patch)
treefad1a7f01f2bbc8981fbe74da237cfbb70ca7793 /src/build/hwpf
parent3c44ccab3932939d32b59d1ddeecdd48da972309 (diff)
downloadtalos-hostboot-8c9986ad90d1ff17af4d8768c83beb526b03626c.tar.gz
talos-hostboot-8c9986ad90d1ff17af4d8768c83beb526b03626c.zip
Task 37141: Provide way to get new Hostboot image with new versions of existing HWPs (all work)
. modify prcd_server.tcl to handle any file under hwpf/hwp . modify prcd_compile.tcl to allow any filename instead of specific 3 . modify prcd_compile_test to test new capability Change-Id: I301c8e6d1801574070066d4e2b3dc411119753e8 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/683 Tested-by: Jenkins Server Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/build/hwpf')
-rwxr-xr-xsrc/build/hwpf/prcd_compile.tcl38
-rwxr-xr-xsrc/build/hwpf/prcd_compile_test47
-rwxr-xr-xsrc/build/hwpf/prcd_server.tcl88
3 files changed, 99 insertions, 74 deletions
diff --git a/src/build/hwpf/prcd_compile.tcl b/src/build/hwpf/prcd_compile.tcl
index 744039969..fa8531fe6 100755
--- a/src/build/hwpf/prcd_compile.tcl
+++ b/src/build/hwpf/prcd_compile.tcl
@@ -263,7 +263,7 @@ proc start_patch_server_on_fsp { fspip fsppassword } {
set userid $::env(USER)
set home $::env(HOME)
set domain [exec hostname -d]
-set version "1.0"
+set version "1.1"
set files [list]
set cmds [list]
@@ -278,40 +278,50 @@ foreach arg $argv {
switch -- $state {
flag {
switch -glob -- $arg {
- -quit { set cmds [list quit] }
- -d { set state driverflag }
+ -quit { set cmds [list quit] }
+ -d { set state driverflag }
# NOT SUPPORTED -s { set state fspflag }
# NOT SUPPORTED -p { set state portflag }
-v { set verbose 1 }
-o { set state outputflag }
- -*h* { puts {prcd_compile.tcl [--help] [-d <drivername>] [-o <ouput dir> ] fapiTestHwp.C fapiTestHwp.H sample.initfile}
+ -*h* { puts {prcd_compile.tcl [--help] [-d <drivername>] [-o <ouput dir> ] <filename> }
puts {}
- puts {Note that currently this tool only supports the 3 files listed above as input }
+ puts {Note this tool only supports *.{c,C,h,H,initfile,xml} files in the following directory trees: }
+ puts { src/usr/hwpf/hwp }
+ puts { src/include/usr/hwpf/hwp }
puts {}
- puts {example: > prcd_compile.tcl -d b0621a_2001_Sprint2 -o ./output/ fapiTestHwp.C fapiTestHwp.C sample.initfile}
+ puts {The files can either be in the working directory, or in a sub-directory mirroring the hostboot tree. }
puts {}
- puts {On success, 5 files (hbicore.bin and hbicore_test.bin, hbicore.syms }
- puts { hbicore_test.syms and hbotStringFile) will be placed in the output dir. }
+ puts {examples }
+ puts {> prcd_compile.tcl -d b0218a_2012_Sprint9 -o ./output fapiTestHwp.C fapiTestHwp.C sample.initfile}
+ puts {> prcd_compile.tcl -d b0218a_2012_Sprint9 -o ./output/ proc_cen_framelock.C }
+ puts {> prcd_compile.tcl -d b0218a_2012_Sprint9 -o output dmi_training/proc_cen_framelock/proc_cen_framelock.H }
+ puts {}
+ puts {On success, files from the img/ directory (*.bin *.syms and hbotStringFile) }
+ puts {will be placed in the output directory. }
puts {}
puts {The -d and -o parameters are optional. Default for -d is the master level of code }
- puts { and default for -o is the current working directory }
+ puts {and default for -o is the current working directory }
puts {}
puts "Version: $version"
puts {}
exit
}
- *fapiTestHwp\.* { lappend files $arg }
*\.initfile { lappend files $arg }
- default { puts "Unsupported File or Argument: $arg "
+ *\.C { lappend files $arg }
+ *\.H { lappend files $arg }
+ *\.h { lappend files $arg }
+ *\.xml { lappend files $arg }
+ default { puts "Unsupported File or Argument: $arg "
exit
}
- }
- }
+ }
+ }
driverflag {
#lappend cmds ":DRIVER $arg"
set driver $arg
set state flag
- }
+ }
fspflag {
foreach {fspip fsp_port} [split $arg :] break
set state flag
diff --git a/src/build/hwpf/prcd_compile_test b/src/build/hwpf/prcd_compile_test
index 5f89cca69..faa0eea1e 100755
--- a/src/build/hwpf/prcd_compile_test
+++ b/src/build/hwpf/prcd_compile_test
@@ -22,10 +22,12 @@
#
# 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
+#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="b1109a_2011_Sprint6"
+BUILD="b0218a_2012_Sprint9"
###############################################################
# Validate return code, exit on failure
@@ -88,15 +90,26 @@ if [ ! -f "./sample.initfile" ]; then
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 ./fapiTestHwp.H ./fapiTestHwp.C &
+{ ./prcd_compile.tcl -d $BUILD -o out1 ./fapiTestHwp.H; check_good_rc_and_bin $? ./out1; } &
sleep 2
-./prcd_compile.tcl -d $BUILD ./fapiTestHwp.H ./fapiTestHwp.C &
+{ ./prcd_compile.tcl -d $BUILD -o out2 ./fapiTestHwp.C; check_good_rc_and_bin $? ./out2; } &
sleep 2
-./prcd_compile.tcl -d $BUILD ./fapiTestHwp.H ./fapiTestHwp.C &
-sleep 20
+{ ./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"
@@ -110,15 +123,13 @@ check_good_rc_and_bin $? ./
echo
echo "TEST - Good Path - 2 Files"
-./prcd_compile.tcl -d $BUILD ./fapiTestHwp.H ./fapiTestHwp.C
+./prcd_compile.tcl -d $BUILD ./proc_cen_framelock.C ./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 "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"
@@ -136,11 +147,7 @@ echo "TEST - Good Path - All Files"
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
+echo "TEST - Good Path - Compile Failure"
+echo COMPILE_FAIL >> fapiTestHwp.H
+./prcd_compile.tcl -d $BUILD fapiTestHwp.H fapiTestHwp.C
check_bad_rc $?
-rm *.bin
-rm /tmp/fapiTestHwp.H
-
diff --git a/src/build/hwpf/prcd_server.tcl b/src/build/hwpf/prcd_server.tcl
index 92613502b..4fcf4b7ba 100755
--- a/src/build/hwpf/prcd_server.tcl
+++ b/src/build/hwpf/prcd_server.tcl
@@ -29,7 +29,7 @@ exec tclsh "$0" "$@"
# Based on if_server.tcl by Doug Gilbert
-set version "1.0"
+set version "1.1"
############################################################################
# Accept is called when a new client request comes in
@@ -46,10 +46,8 @@ proc Accept { sock addr port} {
set socklist(addr,$sock) [list $addr $port]
fconfigure $sock -buffering line
fileevent $sock readable [list AquireData $sock]
-
}
-
############################################################################
# AquireData is called whenever there is data avaiable from a client.
# with line buffering on sock, this means when a line is
@@ -78,7 +76,7 @@ proc AquireData { sock } {
} else {
if { [string compare $line "quit"] == 0 } {
close $socklist(main)
- puts $sock "hw procedure compiler server is terminating"
+ puts $sock "hw procedure compiler server is terminating"
puts $log "$sock: hw procedure compiler server is terminating"
CloseOut $sock
set forever 0
@@ -125,7 +123,7 @@ proc AquireData { sock } {
################################################################
puts $log "$sock: Input File $b $c"
- flush $log
+ flush $log
if { ![info exists sbname($sock)] } {
puts $sock "No sandbox found"
@@ -135,23 +133,34 @@ proc AquireData { sock } {
}
################################################################
- # Create the path to the file in the git sandbox
- # If it's a .C file it goes to src/usr/hwpf/hwp/ otherwise
- # it's a .H and needs to go to src/include/usr/hwpf/hwp/ otherwise
- # it's an initfile and needs to go to src/usr/hwpf/hwp/initfiles/
- # Note that I can't get /* to work correctly in the regexp so I had to
- # hard code in the fapi which should be ok, but annoying.
+ # Find the path to the file in the git sandbox
+ # We will only look in the hwpf/hwp directories (usr and include/usr)
+ # which should be enough. ANY file in there can be replaced, though
+ # the prcd_compile.tcl script inforces *.{c,C,h,H,initfile,xml} files only.
################################################################
- if {[regexp {.*/*(fapi.+\.C)} $b -> file] } {
- set filen "$sb_dir/$sbname($sock)/src/usr/hwpf/hwp/$file"
- } elseif {[regexp {.*/*(fapi.+\.H)} $b -> file] } {
- set filen "$sb_dir/$sbname($sock)/src/include/usr/hwpf/hwp/$file"
- } elseif {[regexp {(.*\.initfile)} $b -> file] } {
- set filen "$sb_dir/$sbname($sock)/src/usr/hwpf/hwp/initfiles/$file"
- } else {
- puts $sock "error: Invalid Input File - $b"
- puts $log "$sock: Invalid Input File - $b"
+ set src_path $sb_dir/$sbname($sock)/src/usr/hwpf/hwp
+ set inc_path $sb_dir/$sbname($sock)/src/include/usr/hwpf/hwp
+ # we can't just find -name $b because that won't find path/filename. -wholename does
+ # that, but we need the $b to not have any ./ prefix if the user included that.
+ # additionally, find usually outputs the file(s) separated by a newline. if there
+ # is a filename that's not unique, we need to flag that as an erorr, so we use the
+ # -printf to force them all onto 1 line.
+ set filen [ exec find $src_path $inc_path -type f -wholename *[ string trimleft $b "./" ] -printf "%p\t" ]
+ # and then truncate the last \t. yeah, hackish..
+ set filen [ string trimright $filen "\t" ]
+ #puts $log "$sock: find found in sandbox: \"$filen\""
+ # error if filen is not just 1 file
+ set filesfound [regexp -all {[^\t]+} $filen ]
+ if { $filesfound == 0 } {
+ puts $sock "error: Invalid Input File - $b - file not found in sandbox"
+ puts $log "$sock: Invalid Input File - $b - file not found in sandbox"
+ CloseOut $sock
+ return
+ }
+ if { $filesfound > 1 } {
+ puts $sock "error: Invalid Input File - $b - filename NOT unique in sandbox"
+ puts $log "$sock: Invalid Input File - $b - filename NOT unique in sandbox"
CloseOut $sock
return
}
@@ -208,9 +217,7 @@ proc AquireData { sock } {
puts $log "$sock: DONE"
flush $sock
}
-
}
-
}
##################################################################
@@ -233,7 +240,7 @@ proc CloseOut { sock } {
puts "[clock format [clock seconds]]: Close $socklist(addr,$sock)- "
unset socklist(addr,$sock)
if {[info exists git_sh($sock)] } {
- # Comment out next line to avoid deleting the /tmp/hwp/ sandbox
+ # Comment out next line to avoid deleting the sandbox
eval {exec} "rm -rf $sb_dir/$sbname($sock)"
unset git_sh($sock)
#unset sandbox($sbname($sock))
@@ -241,7 +248,6 @@ proc CloseOut { sock } {
if {[info exists sbname($sock)]} { unset sbname($sock) }
if {[info exists backint($sock)]} { unset backing($sock) }
-
}
##################################################################
@@ -335,11 +341,8 @@ proc SendSandbox { sock git_sh} {
global sandbox
global running
global sbname
- global missing_spies
global log
- # set missing_spies($sock) {}
-
##################################################################
# Start Compile
##################################################################
@@ -381,10 +384,10 @@ proc SendSandbox { sock git_sh} {
##################################################################
if { [string compare $sandbox($sbname($sock)) "crashed"] == 0 } {
- if { [catch {close $git_sh} res]} {
- puts $sock "Fail: $res\n"
+ if { [catch {close $git_sh} res]} {
+ puts $sock "Fail: $res\n"
puts $log "$sock: Fail: $res\n"
- }
+ }
set sandbox($sbname($sock)) idle
} else {
after cancel $timoutid
@@ -421,16 +424,17 @@ proc IfResult { git_sh sock sbname_sock } {
if { [catch {close $git_sh} res] } {
puts $sock "Error is $res\n"
puts $log "$sock: Error is $res\n"
- }
+ }
set sandbox($sbname_sock) "idle"
} else {
# Uncomment to send back all compile output
#puts $sock "$sock $line"
#puts $log "$sock: $line"
+ #flush $log
if { [string compare $line ":DONE"] == 0 } {
- if { [catch {close $git_sh} res]} {
+ if { [catch {close $git_sh} res]} {
#res has the stderr
# Need to weed out the junk
set rlines [split $res "\n"]
@@ -441,13 +445,14 @@ proc IfResult { git_sh sock sbname_sock } {
puts $log "$sock: $rline"
}
}
- }
+ }
puts $sock "Exit Sandbox"
puts $log "$sock: Exit Sandbox"
+ flush $log
set sandbox($sbname_sock) "idle"
- } else {
+ } else {
foreach exp $explist {
if {[regexp $exp $line a]} {
puts $sock $line
@@ -456,11 +461,13 @@ proc IfResult { git_sh sock sbname_sock } {
}
}
}
+ flush $log
}
##################################################################
-# send the *.if and *.dat files from the compile back to the client
+# send the *.bin, *.sims and hbotStringFile files from the compile
+# back to the client
##################################################################
proc SendObjFiles { sock obj_dir } {
@@ -494,7 +501,6 @@ proc SendObjFiles { sock obj_dir } {
flush $sock
flush $log
-
}
@@ -524,14 +530,16 @@ proc SendFiles { sock files } {
# main
##################################################################
set forever 1
-set logfile {/tmp/prcd_server.log}
+#set base_dir "./"
+set base_dir "/tmp"
+set logfile "$base_dir/prcd_server.log"
set log {}
# Where are we running?
foreach {host site c d} [split [exec hostname] .] break
if {[string compare $host {gfw160}] == 0} {
- set sb_dir {/tmp/hwp/}
+ set sb_dir "$base_dir/hwp/"
eval {exec} "mkdir -p $sb_dir"
} else {
puts "Invalid Location to run server!"
@@ -566,5 +574,5 @@ flush $log
set socklist(main) [socket -server Accept 7779]
-# By catching errors from vwait- we can ignore them
-catch {vwait forever}
+ # By catching errors from vwait- we can ignore them
+ catch {vwait forever}
OpenPOWER on IntegriCloud