Skip to content

Commit c82a544

Browse files
riptlripatel-fd
authored andcommitted
Fix firedancer-dev backtest --no-watch
1 parent a75a301 commit c82a544

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/app/firedancer-dev/commands/backtest.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -362,15 +362,21 @@ backtest_cmd_fn( args_t * args FD_PARAM_UNUSED,
362362
fd_topo_join_workspaces( &config->topo, FD_SHMEM_JOIN_MODE_READ_WRITE );
363363
fd_topo_fill( &config->topo );
364364

365+
args_t watch_args;
365366
int pipefd[2];
366-
if( FD_UNLIKELY( pipe2( pipefd, O_NONBLOCK ) ) ) FD_LOG_ERR(( "pipe2() failed (%i-%s)", errno, fd_io_strerror( errno ) ));
367+
if( !args->backtest.no_watch ) {
368+
if( FD_UNLIKELY( pipe2( pipefd, O_NONBLOCK ) ) ) FD_LOG_ERR(( "pipe2() failed (%i-%s)", errno, fd_io_strerror( errno ) ));
367369

368-
args_t watch_args;
369-
watch_args.watch.drain_output_fd = pipefd[0];
370-
if( FD_UNLIKELY( -1==dup2( pipefd[ 1 ], STDERR_FILENO ) ) ) FD_LOG_ERR(( "dup2() failed (%i-%s)", errno, fd_io_strerror( errno ) ));
370+
watch_args.watch.drain_output_fd = pipefd[0];
371+
if( FD_UNLIKELY( -1==dup2( pipefd[ 1 ], STDERR_FILENO ) ) ) FD_LOG_ERR(( "dup2() failed (%i-%s)", errno, fd_io_strerror( errno ) ));
372+
}
371373

372374
fd_topo_run_single_process( &config->topo, 2, config->uid, config->gid, fdctl_tile_run );
373-
watch_cmd_fn( &watch_args, config );
375+
if( args->backtest.no_watch ) {
376+
for(;;) pause();
377+
} else {
378+
watch_cmd_fn( &watch_args, config );
379+
}
374380
}
375381

376382
action_t fd_action_backtest = {

src/flamenco/runtime/tests/Local.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $(call make-unit-test,test_sol_compat,test_sol_compat,fd_flamenco_test fd_flamen
1616
$(call make-shared,libfd_exec_sol_compat.so,fd_sol_compat,fd_flamenco_test fd_flamenco fd_funk fd_ballet fd_util fd_disco,$(SECP256K1_LIBS) $(SOL_COMPAT_FLAGS))
1717
$(call make-unit-test,test_sol_compat_so,test_sol_compat_so,fd_util)
1818

19-
run-runtime-backtest: $(OBJDIR)/bin/fd_ledger
19+
run-runtime-backtest: $(OBJDIR)/bin/fd_ledger $(OBJDIR)/bin/firedancer-dev
2020
OBJDIR=$(OBJDIR) src/flamenco/runtime/tests/run_backtest_ci.sh
2121

2222
endif

0 commit comments

Comments
 (0)