report error if trying to do a netlist and the file can not be written (example: broken simulation symlink)

This commit is contained in:
stefan schippers 2023-11-14 23:40:41 +01:00
parent 852f2bd25d
commit 5d3b7bd7d0
5 changed files with 47 additions and 52 deletions

View File

@ -2442,6 +2442,11 @@ int rstate; /* (reduced state, without ShiftMask) */
dbg(1, "callback(): -------------\n"); dbg(1, "callback(): -------------\n");
} }
else {
if(has_x) tcleval("alert_ {Can not write into the netlist directory. Please check} {}");
else dbg(0, "Can not write into the netlist directory. Please check");
err = 1;
}
if(err) { if(err) {
if(has_x) { if(has_x) {
tclvareval(xctx->top_path, ".menubar.netlist configure -bg red", NULL); tclvareval(xctx->top_path, ".menubar.netlist configure -bg red", NULL);

View File

@ -775,7 +775,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
} }
} }
/* exit [closewindow] /* exit [closewindow] [force]
* Exit the program, ask for confirm if current file modified. * Exit the program, ask for confirm if current file modified.
* if 'closewindow' is given close the window, otherwise leave with a blank schematic * if 'closewindow' is given close the window, otherwise leave with a blank schematic
* when closing the last remaining window * when closing the last remaining window
@ -2704,6 +2704,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_SetResult(interp, my_itoa(err), TCL_VOLATILE); Tcl_SetResult(interp, my_itoa(err), TCL_VOLATILE);
} }
} }
else {
if(has_x) tcleval("alert_ {Can not write into the netlist directory. Please check} {}");
else dbg(0, "Can not write into the netlist directory. Please check");
err = 1;
}
if(err) { if(err) {
if(has_x) { if(has_x) {
tclvareval(xctx->top_path, ".menubar.netlist configure -bg red", NULL); tclvareval(xctx->top_path, ".menubar.netlist configure -bg red", NULL);

View File

@ -1799,61 +1799,46 @@ proc simulate {{callback {}}} {
set fg {execute} set fg {execute}
} }
set cmd [subst -nobackslashes $sim($tool,$def,cmd)] set cmd [subst -nobackslashes $sim($tool,$def,cmd)]
if {$OS == "Windows"} {
# $cmd cannot be surrounded by {} as exec will change forward slash to backward slash # window interface tabbed interface
set save [pwd] # -----------------------------------------
cd $netlist_dir # top_path win_path top_path win_path
set_simulate_button list [xschem get top_path] [xschem get current_win_path] # {} .drw {} .drw
if { $callback ne {} } { # .x1 .x1.drw {} .x1.drw
uplevel #0 { # .x2 .x2.drw {} .x2.drw
eval $callback set execute(callback) "
} set_simulate_button [list [xschem get top_path] [xschem get current_win_path]]
} $callback
#eval exec {cmd /V /C "cd $netlist_dir&&$cmd} "
eval exec $cmd & # puts $cmd
cd $save
set id 0 if {$fg eq {execute_wait}} {xschem set semaphore [expr {[xschem get semaphore] +1}]}
} else {
# window interface tabbed interface set save [pwd]
# ----------------------------------------- cd $netlist_dir
# top_path win_path top_path win_path # Note: Windows $cmd cannot be surrounded by {} as exec will change forward slash to backward slash
# {} .drw {} .drw set id [eval execute $st $cmd] ;# Start simulation process
# .x1 .x1.drw {} .x1.drw cd $save
# .x2 .x2.drw {} .x2.drw
set execute(callback) " if {[info exists has_x] && $id >= 0 } {
set_simulate_button [list [xschem get top_path] [xschem get current_win_path]] set tctx::[xschem get current_win_path]_simulate_id $id
$callback set button_path [xschem get top_path].menubar.simulate
" $button_path configure -bg yellow
# puts $cmd set tctx::[xschem get current_win_path]_simulate yellow
}
if {$fg eq {execute_wait}} {xschem set semaphore [expr {[xschem get semaphore] +1}]}
puts "Simulation started: execution ID: $id"
set save [pwd]
cd $netlist_dir if {$fg eq {execute_wait}} {
set id [eval execute $st $cmd] ;# Start simulation process if {$id >= 0} {
cd $save vwait execute(pipe,$id)
if {[info exists has_x] && $id >= 0 } {
set tctx::[xschem get current_win_path]_simulate_id $id
set button_path [xschem get top_path].menubar.simulate
$button_path configure -bg yellow
set tctx::[xschem get current_win_path]_simulate yellow
}
puts "Simulation started: execution ID: $id"
if {$fg eq {execute_wait}} {
if {$id >= 0} {
vwait execute(pipe,$id)
}
xschem set semaphore [expr {[xschem get semaphore] -1}]
} }
xschem set semaphore [expr {[xschem get semaphore] -1}]
} }
return $id return $id
} else { } else {
return -1 return -1
} }
} }
proc gaw_echoline {} { proc gaw_echoline {} {

View File

@ -47,7 +47,7 @@ proc create_save {} {
close $fd close $fd
set filename [regsub {\.tcl$} $f {}] set filename [regsub {\.tcl$} $f {}]
set output ${filename}_debug.txt set output ${filename}_debug.txt
if {[catch {eval exec {$xschem_cmd ${results_dir}/$fn_sch -d 1 --script ${testname}/tests/${f} 2> ${results_dir}/$output}} msg]} { if {[catch {eval exec {$xschem_cmd ${results_dir}/$fn_sch --pipe -d 1 --script ${testname}/tests/${f} 2> ${results_dir}/$output}} msg]} {
puts "FATAL: $msg" puts "FATAL: $msg"
incr num_fatals incr num_fatals
} else { } else {

View File

@ -57,4 +57,4 @@ foreach tc $tcases {
} }
source test_utility.tcl source test_utility.tcl
exec $xschem_cmd --pipe -q --script xschemtest.tcl 2>&1 > stefan_xschemtest.log exec $xschem_cmd --pipe -q --script xschemtest.tcl > stefan_xschemtest.log 2>@1