Browse Source

Re-enable builds with DEVELOPER=0

Two changes:
 - Fixed the function signature of noleak_ to match in both
   configurations
 - Added memleak.o to linker for tests

Generating the stubs for the unit tests doesn't really work since the
stubs are checked in an differ between the two configurations, so
adding memleak to the linker fixes that, by not requiring stubs to be
generated in the first place.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
parent
commit
ee25547576
  1. 1
      common/memleak.c
  2. 5
      common/memleak.h
  3. 2
      lightningd/memdump.c
  4. 1
      lightningd/test/Makefile
  5. 6
      lightningd/test/run-find_my_path.c
  6. 1
      wallet/test/Makefile
  7. 6
      wallet/test/run-db.c
  8. 6
      wallet/test/run-wallet.c

1
common/memleak.c

@ -1,6 +1,5 @@
#include <assert.h>
#include <backtrace.h>
#include <ccan/cast/cast.h>
#include <ccan/crypto/siphash24/siphash24.h>
#include <ccan/htable/htable.h>
#include <ccan/tal/tal.h>

5
common/memleak.h

@ -1,6 +1,7 @@
#ifndef LIGHTNING_COMMON_MEMLEAK_H
#define LIGHTNING_COMMON_MEMLEAK_H
#include "config.h"
#include <ccan/cast/cast.h>
#include <ccan/tal/tal.h>
#include <inttypes.h>
@ -43,9 +44,9 @@ void memleak_scan_region(struct htable *memtable, const void *p);
const void *memleak_get(struct htable *memtable, const uintptr_t **backtrace);
#else /* ... !DEVELOPER */
static inline void *notleak_(const void *ptr)
static inline void *notleak_(const void *ptr, bool plus_children UNNEEDED)
{
return ptr;
return cast_const(void *, ptr);
}
#endif /* !DEVELOPER */

2
lightningd/memdump.c

@ -1,5 +1,5 @@
/* Only possible if we're in developer mode. */
#ifdef DEVELOPER
#if DEVELOPER
#include <backtrace.h>
#include <ccan/tal/str/str.h>
#include <common/memleak.h>

1
lightningd/test/Makefile

@ -11,6 +11,7 @@ LIGHTNINGD_TEST_COMMON_OBJS := \
common/daemon_conn.o \
common/htlc_state.o \
common/pseudorand.o \
common/memleak.o \
common/msg_queue.o \
common/utils.o \
common/type_to_string.o \

6
lightningd/test/run-find_my_path.c

@ -44,12 +44,6 @@ struct invoices *invoices_init(const tal_t *ctx UNNEEDED)
void log_(struct log *log UNNEEDED, enum log_level level UNNEEDED, const char *fmt UNNEEDED, ...)
{ fprintf(stderr, "log_ called!\n"); abort(); }
/* Generated stub for memleak_cleanup */
void memleak_cleanup(void)
{ fprintf(stderr, "memleak_cleanup called!\n"); abort(); }
/* Generated stub for memleak_init */
void memleak_init(const tal_t *root UNNEEDED, struct backtrace_state *bstate UNNEEDED)
{ fprintf(stderr, "memleak_init 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(); }

1
wallet/test/Makefile

@ -5,6 +5,7 @@ WALLET_TEST_PROGRAMS := $(WALLET_TEST_OBJS:.o=)
WALLET_TEST_COMMON_OBJS := \
common/htlc_state.o \
common/type_to_string.o \
common/memleak.o \
common/pseudorand.o \
common/utils.o \
lightningd/htlc_end.o \

6
wallet/test/run-db.c

@ -12,12 +12,6 @@ static void db_fatal(const char *fmt, ...);
#include <unistd.h>
/* AUTOGENERATED MOCKS START */
/* Generated stub for memleak_scan_region */
void memleak_scan_region(struct htable *memtable UNNEEDED, const void *p UNNEEDED)
{ fprintf(stderr, "memleak_scan_region called!\n"); abort(); }
/* Generated stub for notleak_ */
void *notleak_(const void *ptr UNNEEDED, bool plus_children UNNEEDED)
{ fprintf(stderr, "notleak_ called!\n"); abort(); }
/* AUTOGENERATED MOCKS END */
static char *db_err;

6
wallet/test/run-wallet.c

@ -16,12 +16,6 @@ static void wallet_fatal(const char *fmt, ...);
#include <unistd.h>
/* AUTOGENERATED MOCKS START */
/* Generated stub for memleak_scan_region */
void memleak_scan_region(struct htable *memtable UNNEEDED, const void *p UNNEEDED)
{ fprintf(stderr, "memleak_scan_region called!\n"); abort(); }
/* Generated stub for notleak_ */
void *notleak_(const void *ptr UNNEEDED, bool plus_children UNNEEDED)
{ fprintf(stderr, "notleak_ called!\n"); abort(); }
/* AUTOGENERATED MOCKS END */
static char *wallet_err;

Loading…
Cancel
Save