@ -3,6 +3,7 @@ int unused_main(int argc, char *argv[]);
# include "../../common/base32.c"
# include "../../common/wireaddr.c"
# include "../lightningd.c"
# include "../subd.c"
/* AUTOGENERATED MOCKS START */
/* Generated stub for activate_peers */
@ -21,6 +22,9 @@ void connectd_activate(struct lightningd *ld UNNEEDED)
/* Generated stub for connectd_init */
int connectd_init ( struct lightningd * ld UNNEEDED )
{ fprintf ( stderr , " connectd_init called! \n " ) ; abort ( ) ; }
/* Generated stub for daemon_poll */
int daemon_poll ( struct pollfd * fds UNNEEDED , nfds_t nfds UNNEEDED , int timeout UNNEEDED )
{ fprintf ( stderr , " daemon_poll called! \n " ) ; abort ( ) ; }
/* Generated stub for daemon_setup */
void daemon_setup ( const char * argv0 UNNEEDED ,
void ( * backtrace_print ) ( const char * fmt UNNEEDED , . . . ) UNNEEDED ,
@ -53,6 +57,18 @@ void fatal(const char *fmt UNNEEDED, ...)
/* Generated stub for free_htlcs */
void free_htlcs ( struct lightningd * ld UNNEEDED , const struct channel * channel UNNEEDED )
{ fprintf ( stderr , " free_htlcs called! \n " ) ; abort ( ) ; }
/* Generated stub for fromwire_status_fail */
bool fromwire_status_fail ( const tal_t * ctx UNNEEDED , const void * p UNNEEDED , enum status_failreason * failreason UNNEEDED , wirestring * * desc UNNEEDED )
{ fprintf ( stderr , " fromwire_status_fail called! \n " ) ; abort ( ) ; }
/* Generated stub for fromwire_status_peer_billboard */
bool fromwire_status_peer_billboard ( const tal_t * ctx UNNEEDED , const void * p UNNEEDED , bool * perm UNNEEDED , wirestring * * happenings UNNEEDED )
{ fprintf ( stderr , " fromwire_status_peer_billboard called! \n " ) ; abort ( ) ; }
/* Generated stub for fromwire_status_peer_error */
bool fromwire_status_peer_error ( const tal_t * ctx UNNEEDED , const void * p UNNEEDED , struct channel_id * channel UNNEEDED , wirestring * * desc UNNEEDED , struct crypto_state * crypto_state UNNEEDED , u8 * * error_for_them UNNEEDED )
{ fprintf ( stderr , " fromwire_status_peer_error called! \n " ) ; abort ( ) ; }
/* Generated stub for get_log_book */
struct log_book * get_log_book ( const struct log * log UNNEEDED )
{ fprintf ( stderr , " get_log_book called! \n " ) ; abort ( ) ; }
/* Generated stub for gossip_init */
void gossip_init ( struct lightningd * ld UNNEEDED , int connectd_fd UNNEEDED )
{ fprintf ( stderr , " gossip_init called! \n " ) ; abort ( ) ; }
@ -84,6 +100,12 @@ void log_backtrace_exit(void)
/* Generated stub for log_backtrace_print */
void log_backtrace_print ( const char * fmt UNNEEDED , . . . )
{ fprintf ( stderr , " log_backtrace_print called! \n " ) ; abort ( ) ; }
/* Generated stub for log_prefix */
const char * log_prefix ( const struct log * log UNNEEDED )
{ fprintf ( stderr , " log_prefix called! \n " ) ; abort ( ) ; }
/* Generated stub for log_status_msg */
bool log_status_msg ( struct log * log UNNEEDED , const u8 * msg UNNEEDED )
{ fprintf ( stderr , " log_status_msg called! \n " ) ; abort ( ) ; }
/* Generated stub for new_log */
struct log * new_log ( const tal_t * ctx UNNEEDED , struct log_book * record UNNEEDED , const char * fmt UNNEEDED , . . . )
{ fprintf ( stderr , " new_log called! \n " ) ; abort ( ) ; }
@ -110,9 +132,6 @@ void setup_jsonrpc(struct lightningd *ld UNNEEDED, const char *rpc_filename UNNE
void setup_topology ( struct chain_topology * topology UNNEEDED , struct timers * timers UNNEEDED ,
u32 min_blockheight UNNEEDED , u32 max_blockheight UNNEEDED )
{ fprintf ( stderr , " setup_topology called! \n " ) ; abort ( ) ; }
/* Generated stub for subd_shutdown */
void subd_shutdown ( struct subd * subd UNNEEDED , unsigned int seconds UNNEEDED )
{ fprintf ( stderr , " subd_shutdown called! \n " ) ; abort ( ) ; }
/* Generated stub for timer_expired */
void timer_expired ( tal_t * ctx UNNEEDED , struct timer * timer UNNEEDED )
{ fprintf ( stderr , " timer_expired called! \n " ) ; abort ( ) ; }
@ -144,16 +163,6 @@ struct wallet *wallet_new(struct lightningd *ld UNNEEDED,
{ fprintf ( stderr , " wallet_new called! \n " ) ; abort ( ) ; }
/* AUTOGENERATED MOCKS END */
/* We only need these in developer mode */
# if DEVELOPER
/* Generated stub for opt_subd_debug */
char * opt_subd_debug ( const char * optarg UNNEEDED , struct lightningd * ld UNNEEDED )
{ fprintf ( stderr , " opt_subd_debug called! \n " ) ; abort ( ) ; }
/* Generated stub for opt_subd_dev_disconnect */
char * opt_subd_dev_disconnect ( const char * optarg UNNEEDED , struct lightningd * ld UNNEEDED )
{ fprintf ( stderr , " opt_subd_dev_disconnect called! \n " ) ; abort ( ) ; }
# endif
struct log * crashlog ;
# undef main
@ -166,26 +175,26 @@ int main(int argc UNUSED, char *argv[] UNUSED)
const char * answer ;
setup_tmpctx ( ) ;
answer = path_canon ( tmpctx , " lightningd/test " ) ;
answer = path_canon ( tmpctx , " lightningd/test/run-find_my_abspath " ) ;
/* Various different ways we could find ourselves. */
argv0 = path_join ( tmpctx ,
path_cwd ( tmpctx ) , " lightningd/test/run-find_my_path " ) ;
path_cwd ( tmpctx ) , " lightningd/test/run-find_my_abs path " ) ;
unsetenv ( " PATH " ) ;
/* Absolute path. */
assert ( streq ( find_my_path ( tmpctx , argv0 ) , answer ) ) ;
assert ( streq ( find_my_abs path ( tmpctx , argv0 ) , answer ) ) ;
/* Relative to cwd. */
argv0 = " lightningd/test/run-find_my_path " ;
assert ( streq ( find_my_path ( tmpctx , argv0 ) , answer ) ) ;
argv0 = " lightningd/test/run-find_my_abs path " ;
assert ( streq ( find_my_abs path ( tmpctx , argv0 ) , answer ) ) ;
/* Using $PATH */
setenv ( " PATH " , path_join ( tmpctx ,
path_cwd ( tmpctx ) , " lightningd/test " ) , 1 ) ;
argv0 = " run-find_my_path " ;
argv0 = " run-find_my_abs path " ;
assert ( streq ( find_my_path ( tmpctx , argv0 ) , answer ) ) ;
assert ( streq ( find_my_abs path ( tmpctx , argv0 ) , answer ) ) ;
/* Even with dummy things in path. */
char * * pathelems = tal_arr ( tmpctx , char * , 4 ) ;
@ -195,7 +204,7 @@ int main(int argc UNUSED, char *argv[] UNUSED)
pathelems [ 3 ] = NULL ;
setenv ( " PATH " , tal_strjoin ( tmpctx , pathelems , " : " , STR_NO_TRAIL ) , 1 ) ;
assert ( streq ( find_my_path ( tmpctx , argv0 ) , answer ) ) ;
assert ( streq ( find_my_abs path ( tmpctx , argv0 ) , answer ) ) ;
assert ( ! taken_any ( ) ) ;
take_cleanup ( ) ;