summaryrefslogtreecommitdiffstats
path: root/src/build/hwpf
diff options
context:
space:
mode:
authorBrian Horton <brianh@linux.ibm.com>2012-02-23 15:41:41 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-02-28 12:05:06 -0600
commitdf05b815a80fc2475aa0396ae140903beaa9dde1 (patch)
tree9f71c6a4bed0fae241f9540ad59e090a61077c26 /src/build/hwpf
parente4c32d91dc6100d9f9bac47855b3f0c675530b1f (diff)
downloadtalos-hostboot-df05b815a80fc2475aa0396ae140903beaa9dde1.tar.gz
talos-hostboot-df05b815a80fc2475aa0396ae140903beaa9dde1.zip
Task 37138 Provide way to test if new HWP will compile in Hostboot (all work)
. update prcd_compile.tcl to support new -n flag to say all files are new HWP . update prcd_server.tcl to support new HWP_FILE_NEW and HWP_COMPILE_NEW commands to create tmp directory and makefile for new HWP . update prcd_compile_test to test new -n flag. Change-Id: I275e2662026cdb020aaedd81c8ca6ea0576926f8 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/690 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.tcl70
-rwxr-xr-xsrc/build/hwpf/prcd_compile_test24
-rwxr-xr-xsrc/build/hwpf/prcd_server.tcl239
3 files changed, 239 insertions, 94 deletions
diff --git a/src/build/hwpf/prcd_compile.tcl b/src/build/hwpf/prcd_compile.tcl
index fa8531fe6..5ecb50068 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.1"
+set version "1.2"
set files [list]
set cmds [list]
@@ -284,22 +284,31 @@ foreach arg $argv {
# 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> ] <filename> }
+ -n { set newfiles 1 }
+ -*h* { puts {prcd_compile.tcl [--help] [-d <drivername>] [-o <ouput dir> ] [-n] <filename> }
puts {}
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 {The files can either be in the working directory, or in a sub-directory mirroring the hostboot tree. }
+ puts {The files can either be in the local current working directory, or in a local sub-directory mirroring the hostboot tree. }
puts {}
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 {Without the -n parameter, the file are assumed to be existing files in the hostboot sandbox.}
+ puts {If they are not found in the sandbox, an error will be returned.}
+ puts {}
puts {On success, files from the img/ directory (*.bin *.syms and hbotStringFile) }
puts {will be placed in the output directory. }
puts {}
+ puts {With the -n parameter, the files are assumed to be for a NEW HWP and will be checked to see}
+ puts {if they compile - no binary image files will be returned.}
+ puts {examples }
+ puts {> prcd_compile.tcl -n mss_l3.C mss_l3.H}
+ 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 {}
@@ -396,23 +405,47 @@ lappend cmds ":INFO userid $userid version $version"
lappend cmds ":DRIVER $driver"
-##########################################################
-# Generate command to send each input file
-##########################################################
-foreach filen $files {
+if {[info exists newfiles]} {
- set file_size [file size $filen]
- set filesource($filen) $filen
- lappend cmds ":HWP_FILE $filen $file_size"
-}
+ # NEW HWP file(s)
+
+ ##########################################################
+ # Generate command to send each input file
+ ##########################################################
+ foreach filen $files {
+
+ set file_size [file size $filen]
+ set filesource($filen) $filen
+ lappend cmds ":HWP_FILE_NEW $filen $file_size"
+ }
-##########################################################
-# Generate compile, retrieve, and complete directives
-##########################################################
-lappend cmds ":HWP_COMPILE"
-lappend cmds ":HWP_RETRIEVE"
-lappend cmds ":HWP_DONE"
+ ##########################################################
+ # Generate compile and complete directives
+ ##########################################################
+ lappend cmds ":HWP_COMPILE_NEW"
+ lappend cmds ":HWP_DONE"
+} else {
+
+ # existing file(s)
+
+ ##########################################################
+ # Generate command to send each input file
+ ##########################################################
+ foreach filen $files {
+
+ set file_size [file size $filen]
+ set filesource($filen) $filen
+ lappend cmds ":HWP_FILE $filen $file_size"
+ }
+
+ ##########################################################
+ # Generate compile, retrieve, and complete directives
+ ##########################################################
+ lappend cmds ":HWP_COMPILE"
+ lappend cmds ":HWP_RETRIEVE"
+ lappend cmds ":HWP_DONE"
+}
set xfer_file_list {}
@@ -440,7 +473,6 @@ if {[llength $cmds] > 0 } {
# Now send all of the commands we generated sequentially
# to the server, waiting for a :DONE between each one.
##########################################################
- # Note that currently we only support fapiTestHwp.C and .H as input
if {$result == ""} {
puts "Connected to $server - Starting Compile"
foreach cmd $cmds {
@@ -448,7 +480,7 @@ if {[llength $cmds] > 0 } {
if {[string compare $cmd {quit}] == 0 } {
puts $sockid {quit}
break
- } elseif {[regexp {^:HWP_FILE +(.+) +(.+)} $cmd a hwpfilename filesize]} {
+ } elseif {[regexp {^:HWP_FILE.* +(.+) +(.+)} $cmd a hwpfilename filesize]} {
puts $sockid $cmd
set hwpfile [open $filesource($hwpfilename) r]
fconfigure $sockid -translation binary
diff --git a/src/build/hwpf/prcd_compile_test b/src/build/hwpf/prcd_compile_test
index faa0eea1e..69c6969a3 100755
--- a/src/build/hwpf/prcd_compile_test
+++ b/src/build/hwpf/prcd_compile_test
@@ -147,6 +147,30 @@ echo "TEST - Good Path - All Files"
check_good_rc_and_bin $? ./output/
echo
+echo "TEST - New working HWP"
+cat >> mss_compile_test.C << EOF
+#include <fapi.H>
+#include <mss_compile_test.H>
+fapi::ReturnCode mss_compile_test(std::vector<fapi::Target> & 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 <fapi.H>
+typedef fapi::ReturnCode (*mss_comile_test_FP_t)(std::vector<fapi::Target> &);
+extern "C" { fapi::ReturnCode mss_comile_test(std::vector<fapi::Target> & 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
diff --git a/src/build/hwpf/prcd_server.tcl b/src/build/hwpf/prcd_server.tcl
index 4fcf4b7ba..8f80515c7 100755
--- a/src/build/hwpf/prcd_server.tcl
+++ b/src/build/hwpf/prcd_server.tcl
@@ -29,18 +29,17 @@ exec tclsh "$0" "$@"
# Based on if_server.tcl by Doug Gilbert
-set version "1.1"
+set version "1.2"
############################################################################
# Accept is called when a new client request comes in
# An event is forked that calls AquireData whenever the socket becomes
# readable the main thread continues to run looking for more client requests
############################################################################
-
proc Accept { sock addr port} {
-
global socklist
global log
+
puts "[clock format [clock seconds]]: Accept $sock from $addr port $port"
puts $log "$port: [clock format [clock seconds]]: Accept $sock from $addr port $port"
set socklist(addr,$sock) [list $addr $port]
@@ -49,13 +48,11 @@ proc Accept { sock addr port} {
}
############################################################################
-# AquireData is called whenever there is data avaiable from a client.
+# AquireData is called whenever there is data avaiable from a client.
# with line buffering on sock, this means when a line is
# Processes commands and collect data from client
############################################################################
-
proc AquireData { sock } {
-
global socklist
global sandbox
global forever
@@ -68,7 +65,6 @@ proc AquireData { sock } {
global running
global driver
-
if { [eof $sock] || [catch {gets $sock line}] } {
puts "Client closed unexpectedly"
puts $log "$sock: Client closed unexpectedly"
@@ -86,7 +82,6 @@ proc AquireData { sock } {
# Make a unique sandbox backed to the driver specified
# Do a workon to the sandbox.
################################################################
-
set driver $b
set release ""
puts $log "$sock: Input driver $driver"
@@ -95,7 +90,6 @@ proc AquireData { sock } {
################################################################
# create git repository
################################################################
-
set sbname($sock) "sb[string range [clock seconds] 4 end]"
puts $sock "$sbname($sock)"
@@ -121,7 +115,6 @@ proc AquireData { sock } {
################################################################
# Open the hw procedure file in the hw procedure directory
################################################################
-
puts $log "$sock: Input File $b $c"
flush $log
@@ -130,8 +123,8 @@ proc AquireData { sock } {
puts $log "$sock: No sandbox found"
CloseOut $sock
return
-
}
+
################################################################
# Find the path to the file in the git sandbox
# We will only look in the hwpf/hwp directories (usr and include/usr)
@@ -190,6 +183,79 @@ proc AquireData { sock } {
puts $log "$sock: DONE"
flush $sock
flush $log
+ } elseif {[regexp {:HWP_FILE_NEW +(.+) +(.+)} $line a b c] } {
+
+ ################################################################
+ # Open the hw procedure file in the hw procedure directory
+ ################################################################
+ puts $log "$sock: Input New File $b $c"
+ flush $log
+
+ if { ![info exists sbname($sock)] } {
+ puts $sock "No sandbox found"
+ puts $log "$sock: No sandbox found"
+ CloseOut $sock
+ return
+ }
+
+ ################################################################
+ # determine the path to the file in the git sandbox
+ ################################################################
+ set newdir $sb_dir/$sbname($sock)/src/usr/hwpf/hwp/mss_new
+ set filen $newdir/$b
+ if {![file exists $newdir]} {
+ #puts $log "$sock: mkdir \"$newdir\""; flush $log
+ eval {exec} "mkdir -p $newdir"
+ }
+
+ #puts $log "$sock: writing filen: \"$filen\""; flush $log
+ # Open with create/overwrite option
+ if {[catch {set hwpfile($sock) [open "$filen" w+] } res ] } {
+ puts $sock "Server can't open $filen"
+ puts $log "$sock: Server can't open $filen"
+ CloseOut $sock
+ } else {
+ fconfigure $hwpfile($sock) -translation binary
+ fconfigure $sock -translation binary
+ fcopy $sock $hwpfile($sock) -size $c
+ close $hwpfile($sock)
+ fconfigure $sock -translation auto
+ puts $sock ":DONE"
+ puts $log "$sock: DONE"
+ flush $sock
+ }
+ } elseif {[string compare $line ":HWP_COMPILE_NEW"] == 0} {
+ set git_sh($sock) [open "|bash" r+]
+ fconfigure $git_sh($sock) -buffering none
+ fileevent $git_sh($sock) readable [list IfResult $git_sh($sock) $sock $sbname($sock)]
+ puts $git_sh($sock) "cd $sb_dir/$sbname($sock)"
+
+ ##################################################################
+ # create the new tmp makefile
+ ##################################################################
+ set newdir $sb_dir/$sbname($sock)/src/usr/hwpf/hwp/mss_new
+ set new_makefile $newdir/makefile
+ #puts $log "$sock: creating makefile \"$new_makefile\"";flush $log
+
+ set mkfile {}
+ set mkfile [open "$new_makefile" w 0666]
+ puts $mkfile "ROOTPATH = ../../../../.."
+ puts $mkfile "MODULE = mss_volt"
+ puts $mkfile "EXTRAINCDIR += \${ROOTPATH}/src/include/usr/ecmddatabuffer \${ROOTPATH}/src/include/usr/hwpf/fapi \\"
+ puts $mkfile "\${ROOTPATH}/src/include/usr/hwpf/plat \${ROOTPATH}/src/include/usr/hwpf/hwp \\"
+ puts $mkfile "\${ROOTPATH}/src/usr/hwpf/hwp/include ."
+ puts $mkfile "SRCS_c = \$(wildcard *.c)"
+ puts $mkfile "SRCS_C = \$(wildcard *.C)"
+ puts $mkfile "OBJS = \$(SRCS_c:.c=.o) \$(SRCS_C:.C=.o)"
+ puts $mkfile "include \${ROOTPATH}/config.mk"
+ flush $mkfile
+ close $mkfile
+
+ SendSandboxNew $sock $git_sh($sock)
+ puts $sock ":DONE"
+ puts $log "$sock: DONE"
+ flush $sock
+ flush $log
} elseif {[string compare $line ":HWP_RETRIEVE"] == 0} {
SendObjFiles $sock "$sb_dir/$sbname($sock)/img"
puts $sock ":DONE"
@@ -288,24 +354,21 @@ proc ExtractSandbox { sock git_sh} {
flush $git_sh
############################################################
- ## if the git_sh is not done by 180 sec, it probably crashed
+ ## if the git_sh is not done by 30 sec, it probably crashed
## keep a list of running sandboxes
## hopefully processes timeout in the same order they were started
- ## Kick off an event that waits 10 sec then executes
+ ## Kick off an event that waits 30 sec then executes
############################################################
-
lappend running $sbname($sock)
- set timoutid [after 10000 {
+ set timoutid [after 30000 {
set sandbox([lindex $running 0]) crashed
lreplace $running 0 0
} ]
-
############################################################
## This thread now waits until an event changes sandbox($sbname)
## either the simulator exits or times out
############################################################
-
vwait sandbox($sbname($sock))
############################################################
@@ -331,7 +394,6 @@ proc ExtractSandbox { sock git_sh} {
flush $sock
}
-
##################################################################
# Sets up the sandbox for the ifcompiler & sends commands
# sets up an event to collect the simulation results
@@ -343,46 +405,100 @@ proc SendSandbox { sock git_sh} {
global sbname
global log
-##################################################################
-# Start Compile
-##################################################################
-
+ ##################################################################
+ # Start Compile
+ ##################################################################
puts $git_sh "source env.bash; make -j4"
-##################################################################
-# tell the workon shell to terminate
-##################################################################
-
+ ##################################################################
+ # tell the workon shell to terminate
+ ##################################################################
puts $git_sh {echo :DONE}
flush $git_sh
-##################################################################
-## if the git_sh is not done by 180 sec, it probably crashed
-## keep a list of running sandboxes
-## hopefully processes timeout in the same order they were started
-## Kick off an event that waits 180 sec then executes
-##################################################################
-
+ ##################################################################
+ ## if the git_sh is not done by 360 sec, it probably crashed
+ ## keep a list of running sandboxes
+ ## hopefully processes timeout in the same order they were started
+ ## Kick off an event that waits 360 sec then executes
+ ##################################################################
lappend running $sbname($sock)
- set timoutid [after 180000 {
+ set timoutid [after 360000 {
set sandbox([lindex $running 0]) crashed
lreplace $running 0 0
-
} ]
+ ##################################################################
+ ## This thread now waits until an event changes sandbox($sbname)
+ ## either the simulator exits or timesout
+ ##################################################################
+ vwait sandbox($sbname($sock))
-##################################################################
-## This thread now waits until an event changes sandbox($sbname)
-## either the simulator exits or timesout
-##################################################################
+ ##################################################################
+ # If the git_sh workon crashed then close the workon shell else cancel the
+ # timout event
+ ##################################################################
+ if { [string compare $sandbox($sbname($sock)) "crashed"] == 0 } {
+ 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
+ }
- vwait sandbox($sbname($sock))
+ flush $sock
+ flush $log
+}
##################################################################
-# If the git_sh workon crashed then close the workon shell else cancel the
-# timout event
+# Sets up the sandbox for the ifcompiler & sends commands
+# create a makefile to build the new HWP and build
+# sets up an event to collect the simulation results
+# closes and deletes the sandbox
##################################################################
+proc SendSandboxNew { sock git_sh} {
+ global sandbox
+ global running
+ global sbname
+ global log
+
+ ##################################################################
+ # Start Compile
+ ##################################################################
+ set newdir src/usr/hwpf/hwp/mss_new
+ puts $git_sh "source env.bash; make -j4; make -C $newdir"
+
+ ##################################################################
+ # tell the workon shell to terminate
+ ##################################################################
+ puts $git_sh {echo :DONE}
+ flush $git_sh
+
+ ##################################################################
+ ## if the git_sh is not done by 360 sec, it probably crashed
+ ## keep a list of running sandboxes
+ ## hopefully processes timeout in the same order they were started
+ ## Kick off an event that waits 360 sec then executes
+ ##################################################################
+ lappend running $sbname($sock)
+ set timoutid [after 360000 {
+ set sandbox([lindex $running 0]) crashed
+ lreplace $running 0 0
+ } ]
+
+ ##################################################################
+ ## This thread now waits until an event changes sandbox($sbname)
+ ## either the simulator exits or timesout
+ ##################################################################
+ vwait sandbox($sbname($sock))
+
+ ##################################################################
+ # If the git_sh workon crashed then close the workon shell else cancel the
+ # timout event
+ ##################################################################
if { [string compare $sandbox($sbname($sock)) "crashed"] == 0 } {
if { [catch {close $git_sh} res]} {
puts $sock "Fail: $res\n"
@@ -397,7 +513,6 @@ proc SendSandbox { sock git_sh} {
flush $log
}
-
##################################################################
# This is a list of regular expressions. Any line sent to stdout during
# mk processing that matches one of these expressions will be sent to the
@@ -411,7 +526,6 @@ set explist [list {ERROR:.*} {^IfScrub..E>.*} {^Parse Error.*} ]
## and sends it back to the client.
## The git_sh pipe is closed when the full result has been processed
##################################################################
-
proc IfResult { git_sh sock sbname_sock } {
global sandbox
global explist
@@ -470,31 +584,14 @@ proc IfResult { git_sh sock sbname_sock } {
# back to the client
##################################################################
proc SendObjFiles { sock obj_dir } {
-
global log
set hbi_files {}
- # Send the .bin files
- if {[catch {set hbi_files [glob -dir $obj_dir *.bin]} res]} {
- puts $sock "ERROR: No *.bin files found in $obj_dir"
- puts $log "$sock: ERROR: No *.bin files found in $obj_dir"
- } else {
- SendFiles $sock $hbi_files
- }
-
- # Now send the .syms files
- if {[catch {set hbi_files [glob -dir $obj_dir *.syms]} res]} {
- puts $sock "ERROR: No *.syms files found in $obj_dir"
- puts $log "$sock: ERROR: No *.syms files found in $obj_dir"
- } else {
- SendFiles $sock $hbi_files
- }
-
- # Now send the hbotStringFile
- if {[catch {set hbi_files [glob -dir $obj_dir hbotStringFile]} res]} {
- puts $sock "ERROR: No hbotStringFile files found in $obj_dir"
- puts $log "$sock: ERROR: No hbotStringFile files found in $obj_dir"
+ # Send the image files
+ if {[catch {set hbi_files [glob -dir $obj_dir simics*.bin vbu*bin hbicore*.bin *.syms hbotStringFile]} res]} {
+ puts $sock "ERROR: Needed image files not found in $obj_dir"
+ puts $log "$sock: ERROR: Needed image files not found in $obj_dir"
} else {
SendFiles $sock $hbi_files
}
@@ -503,7 +600,6 @@ proc SendObjFiles { sock obj_dir } {
flush $log
}
-
##################################################################
# Send a file to the client
##################################################################
@@ -524,8 +620,6 @@ proc SendFiles { sock files } {
flush $log
}
-
-
##################################################################
# main
##################################################################
@@ -535,7 +629,6 @@ 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} {
@@ -548,23 +641,19 @@ if {[string compare $host {gfw160}] == 0} {
# array to keep track of ode sandboxes and thier state
array set sandbox {
-
sb00000000 idle
-
}
array set backing {}
puts "Logfile: $logfile"
-
if { [file exists $logfile] } {
set log [open "$logfile" a]
} else {
set log [open "$logfile" w 0666]
}
-
puts "Logfile: $logfile $log"
exec chmod 666 $logfile
@@ -574,5 +663,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