Skip to content

Commit

Permalink
improve static deps management
Browse files Browse the repository at this point in the history
  • Loading branch information
cesar-douady committed Apr 30, 2024
1 parent 74363a4 commit 3e397f3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
2 changes: 0 additions & 2 deletions _lib/lmake_dbg.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ def run_pdb(dbg_dir,redirected,func,*args,**kwds) :
def run_vscode(dbg_dir,redirected,func,*args,**kwds) :
import json
import os
import signal
signal.signal(signal.SIGPIPE,signal.SIG_IGN) # vscode seems to be sensitive to SIGPIPE
try :
# Write python process information to vscode debug workspace to allow gdb to attache to it
workspace = dbg_dir + '/vscode/ldebug.code-workspace'
Expand Down
2 changes: 1 addition & 1 deletion src/lmakeserver/cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ R"({
if (dep.dflags[Dflag::Static]) append_to_string( script , "args+=( ",mk_shell_str(dep->name()),")\n" ) ; // list dependences file to open in vscode
append_to_string( script , "args+=(\"${DEBUG_DIR}/cmd\")\n" ) ;
append_to_string( script , "args+=(\"${DEBUG_DIR}/vscode/ldebug.code-workspace\")\n" ) ;
append_to_string( script , "code -n -w ${args[@]} &" ) ;
append_to_string( script , "code -n -w --password-store=basic ${args[@]} &" ) ;
} else {
::vmap_ss env = _mk_env(start.env,report_end.end.dynamic_env) ;
/**/ append_to_string( script , "exec env -i" , " \\\n" ) ;
Expand Down
11 changes: 6 additions & 5 deletions src/lmakeserver/job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -796,13 +796,14 @@ namespace Engine {
bool sense_err = !dep.dflags[Dflag::IgnoreError] ;
bool required = dep.dflags[Dflag::Required ] || is_static ;
bool modif = state.stamped_modif || ri.force ;
bool may_care = care || (modif&&is_static) ; // if previous modif, consider static deps as fully accessed, as initially
NodeReqInfo const* cdri = &dep->c_req_info(req) ; // avoid allocating req_info as long as not necessary
NodeReqInfo * dri = nullptr ; // .
NodeGoal dep_goal =
ri.full && care && (need_run(state)||archive) ? NodeGoal::Dsk
: ri.full && (care||sense_err) ? NodeGoal::Status
: required ? NodeGoal::Makable
: NodeGoal::None
ri.full && may_care && (need_run(state)||archive) ? NodeGoal::Dsk
: ri.full && (may_care||sense_err) ? NodeGoal::Status
: required ? NodeGoal::Makable
: NodeGoal::None
;
if (!dep_goal) continue ; // this is not a dep (not static while asked for makable only)
RestartDep :
Expand Down Expand Up @@ -831,7 +832,7 @@ namespace Engine {
critical_waiting |= is_critical ;
} else {
SWEAR(dnd.done(*cdri,dep_goal)) ; // after having called make, dep must be either waiting or done
bool dep_missing_dsk = ri.full && care && !dnd.done(*cdri,NodeGoal::Dsk) ;
bool dep_missing_dsk = ri.full && may_care && !dnd.done(*cdri,NodeGoal::Dsk) ;
state.missing_dsk |= dep_missing_dsk ; // job needs this dep if it must run
if (dep_goal==NodeGoal::Makable) {
if ( is_static && required && dnd.ok(*cdri,dep.accesses)==Maybe ) {
Expand Down
13 changes: 8 additions & 5 deletions unit_tests/misc13.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,26 @@

class Hdep(Rule) :
target = r'hdep'
cmd = 'echo 2'
cmd = 'echo {step}'

class Sdep(Rule) :
target = r'sdep'
cmd = 'echo {step}'
cmd = 'echo sdep'

class Dut(Rule) :
target = 'dut'
dep = 'sdep'
cmd = '[ $(cat hdep) = {step} ] && cat sdep'
deps = { 'SDEP' : 'sdep' }
cmd = '[ $(cat hdep) = 2 ] && cat sdep'

else :

import os

import ut

print('step=1',file=open('step.py','w'))
ut.lmake( 'dut' , may_rerun=1 , done=2 , failed=1 , rc=1 )

print('step=2',file=open('step.py','w'))
ut.lmake( 'dut' , done=2 ) # check sdep is not forgetten due to execution w/o hdep
os.unlink('sdep')
ut.lmake( 'dut' , done=2 , steady=1 ) # check sdep is not forgetten due to execution w/o hdep
2 changes: 1 addition & 1 deletion unit_tests/misc8.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ class Chk(Rule) :
ut.lmake( 'dep' , done=1 )

print('step=2',file=open('step.py','w'))
ut.lmake( 'chk' , may_rerun=2 , done=5 ) # check that dut1 is remade after first run of dut2 despite having been done before
ut.lmake( 'chk' , may_rerun=1 , done=5 ) # check that dut1 is remade after first run of dut2 despite having been done before

0 comments on commit 3e397f3

Please sign in to comment.