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");
}
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(has_x) {
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.
* if 'closewindow' is given close the window, otherwise leave with a blank schematic
* 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);
}
}
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(has_x) {
tclvareval(xctx->top_path, ".menubar.netlist configure -bg red", NULL);

View File

@ -1799,61 +1799,46 @@ proc simulate {{callback {}}} {
set fg {execute}
}
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
set save [pwd]
cd $netlist_dir
set_simulate_button list [xschem get top_path] [xschem get current_win_path]
if { $callback ne {} } {
uplevel #0 {
eval $callback
}
}
#eval exec {cmd /V /C "cd $netlist_dir&&$cmd}
eval exec $cmd &
cd $save
set id 0
} else {
# window interface tabbed interface
# -----------------------------------------
# top_path win_path top_path win_path
# {} .drw {} .drw
# .x1 .x1.drw {} .x1.drw
# .x2 .x2.drw {} .x2.drw
set execute(callback) "
set_simulate_button [list [xschem get top_path] [xschem get current_win_path]]
$callback
"
# puts $cmd
if {$fg eq {execute_wait}} {xschem set semaphore [expr {[xschem get semaphore] +1}]}
set save [pwd]
cd $netlist_dir
set id [eval execute $st $cmd] ;# Start simulation process
cd $save
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}]
# window interface tabbed interface
# -----------------------------------------
# top_path win_path top_path win_path
# {} .drw {} .drw
# .x1 .x1.drw {} .x1.drw
# .x2 .x2.drw {} .x2.drw
set execute(callback) "
set_simulate_button [list [xschem get top_path] [xschem get current_win_path]]
$callback
"
# puts $cmd
if {$fg eq {execute_wait}} {xschem set semaphore [expr {[xschem get semaphore] +1}]}
set save [pwd]
cd $netlist_dir
# Note: Windows $cmd cannot be surrounded by {} as exec will change forward slash to backward slash
set id [eval execute $st $cmd] ;# Start simulation process
cd $save
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}]
}
return $id
} else {
return -1
}
}
proc gaw_echoline {} {

View File

@ -47,7 +47,7 @@ proc create_save {} {
close $fd
set filename [regsub {\.tcl$} $f {}]
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"
incr num_fatals
} else {

View File

@ -57,4 +57,4 @@ foreach tc $tcases {
}
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