Skip to content

Commit

Permalink
fixed bug in critical deps
Browse files Browse the repository at this point in the history
  • Loading branch information
cesar-douady committed Apr 9, 2024
1 parent d66771b commit 826b8e7
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
1 change: 1 addition & 0 deletions Manifest
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ unit_tests/codec.py
unit_tests/conflict.py
unit_tests/conflict2.py
unit_tests/critical.py
unit_tests/critical2.py
unit_tests/cwd.py
unit_tests/cycle.py
unit_tests/depend.py
Expand Down
4 changes: 2 additions & 2 deletions src/lmakeserver/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -797,8 +797,8 @@ namespace Engine {
void Deps::replace_tail( DepsIter it , ::vector<Dep> const& deps ) {
// close current chunk
GenericDep* cur_dep = const_cast<GenericDep*>(it.hdr) ;
cur_dep->hdr.sz = it.i_chunk ;
if (it.i_chunk!=0) {
cur_dep->hdr.sz = it.i_chunk ;
_fill_hole(*cur_dep) ;
cur_dep = cur_dep->next() ;
}
Expand All @@ -808,7 +808,7 @@ namespace Engine {
for( auto const& d : deps ) _append_dep( ds , d , hole ) ;
_fill_hole(ds,hole) ;
// splice it
NodeIdx tail_sz = cur_dep-items() ;
NodeIdx tail_sz = items()+DepsBase::size()-cur_dep ;
if (ds.size()<=tail_sz) {
for( GenericDep const& d : ds ) *cur_dep++ = d ; // copy all
shorten_by(tail_sz-ds.size()) ; // and shorten
Expand Down
33 changes: 33 additions & 0 deletions unit_tests/critical2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file is part of the open-lmake distribution ([email protected]:cesar-douady/open-lmake.git)
# Copyright (c) 2023 Doliam
# This program is free software: you can redistribute/modify under the terms of the GPL-v3 (https://www.gnu.org/licenses/gpl-3.0.html).
# This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

if __name__!='__main__' :

import lmake
from lmake.rules import Rule,PyRule

lmake.manifest = (
'Lmakefile.py'
, 'lst'
)

class GenFile(Rule) :
target = r'dep{Digit:\d+}'
cmd = ''

class All(PyRule) :
target = 'dut'
deps = { 'LST' : ('lst','Critical') }
def cmd() :
from lmake import depend
for t in open(LST).readlines() :
depend(t.strip())

else :

import ut

print('dep1',file=open('lst','w')) ; ut.lmake( 'dut' , new =1 , may_rerun=1 , done=1 , steady=1 )
print('dep2',file=open('lst','a')) ; ut.lmake( 'dut' , changed=1 , may_rerun=1 , done=1 , steady=1 )

0 comments on commit 826b8e7

Please sign in to comment.