Commit 73e97969 authored by dylan grafmyre's avatar dylan grafmyre
Browse files

epoll-then

parent 04418fc7
...@@ -178,10 +178,12 @@ maps/%.bsp: %.bsp ...@@ -178,10 +178,12 @@ maps/%.bsp: %.bsp
ln -f lua/nav_generate.lua "$(MOD_DIR)/lua/autorun/runme.lua" ln -f lua/nav_generate.lua "$(MOD_DIR)/lua/autorun/runme.lua"
$(SHLEX_BIN) $(SHLEX_FLAGS) $(SHLEX_HL2LOG_FLAGS) \ $(SHLEX_BIN) $(SHLEX_FLAGS) $(SHLEX_HL2LOG_FLAGS) \
"'$(GAME_DIR)$(GAME)'" -allowdebug $(VBIN_FLAGS) $(GAME_FLAGS) $(GAME_TTT_FLAGS) \ "'$(GAME_DIR)$(GAME)'" -allowdebug $(VBIN_FLAGS) $(GAME_FLAGS) $(GAME_TTT_FLAGS) \
+sv_cheats 1 +nav_edit 1 +map navgen || true +sv_cheats 1 +nav_edit 1 +map navgen &
$(SHLEX_BIN) $(SHLEX_FLAGS) $(EPOLL_THEN_BIN) $(EPOLL_THEN_FLAGS) --literal ng_2 --file "'$(MOD_DIR)/data/runme.txt'" -- \ $(SHLEX_BIN) $(SHLEX_FLAGS) $(EPOLL_THEN_BIN) $(EPOLL_THEN_FLAGS) \
echo TIME TO DO THINGS & --literal ng_f --file "'$(MOD_DIR)/data/runme.txt'" --timeout-sec 1800 -- \
# todo: check "$(MOD_DIR)/data/runme.txt" for content "ng_f", to trigger kill hl2.exe kill $$!
# ^ watch "$(MOD_DIR)/data/runme.txt" for content "ng_f", when match: kill hl2.exe
# timeout: 30min
cp -v "$(MOD_DIR)/maps/navgen.nav" $@ cp -v "$(MOD_DIR)/maps/navgen.nav" $@
rm -v \ rm -v \
"$(MOD_DIR)/lua/autorun/runme.lua" \ "$(MOD_DIR)/lua/autorun/runme.lua" \
......
...@@ -16,6 +16,7 @@ ARGP.add_argument('remainder', nargs=argparse.REMAINDER) ...@@ -16,6 +16,7 @@ ARGP.add_argument('remainder', nargs=argparse.REMAINDER)
ARGP.add_argument('--file', required=True) ARGP.add_argument('--file', required=True)
ARGP.add_argument('--literal', required=True) ARGP.add_argument('--literal', required=True)
ARGP.add_argument('--poll-sec', type=float, default=2) ARGP.add_argument('--poll-sec', type=float, default=2)
ARGP.add_argument('--timeout-sec', type=float)
def main(argp=None, argv=None): def main(argp=None, argv=None):
if argp is None: if argp is None:
...@@ -27,6 +28,7 @@ def main(argp=None, argv=None): ...@@ -27,6 +28,7 @@ def main(argp=None, argv=None):
level=logging.INFO, level=logging.INFO,
) )
start = time.time()
while True: while True:
with open(argp.file) as fh: with open(argp.file) as fh:
dat = fh.read() dat = fh.read()
...@@ -35,6 +37,10 @@ def main(argp=None, argv=None): ...@@ -35,6 +37,10 @@ def main(argp=None, argv=None):
if match: if match:
break break
if arp.timeout_sec:
if (time.time() - start) > argp.timeout_sec:
LOGGER.warning('status: match=%s %s=%r', (match, argp.literal), argp.file, dat)
raise TimeoutError('epoll-then timeout')
time.sleep(argp.poll_sec) time.sleep(argp.poll_sec)
if argp.remainder: if argp.remainder:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment