mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-18 14:44:22 +01:00
update-mocks: handle missing deprecated_apis.
This expands update-mocks to be able to handle (simple!) missing symbols which are not functions. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -8,8 +8,6 @@
|
||||
#include <ccan/tal/path/path.h>
|
||||
#include <common/setup.h>
|
||||
|
||||
bool deprecated_apis = false;
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for amount_asset_is_main */
|
||||
bool amount_asset_is_main(struct amount_asset *asset UNNEEDED)
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
/* Definition of n1 from the spec */
|
||||
#include <wire/peer_wire.h>
|
||||
|
||||
bool deprecated_apis = false;
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for features_unsupported */
|
||||
int features_unsupported(const struct feature_set *our_features UNNEEDED,
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
#include <ccan/tal/path/path.h>
|
||||
#include <common/setup.h>
|
||||
|
||||
bool deprecated_apis = false;
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for amount_asset_is_main */
|
||||
bool amount_asset_is_main(struct amount_asset *asset UNNEEDED)
|
||||
|
||||
@@ -37,9 +37,6 @@ struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u
|
||||
/* Generated stub for amount_tx_fee */
|
||||
struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED)
|
||||
{ fprintf(stderr, "amount_tx_fee called!\n"); abort(); }
|
||||
/* Generated stub for memleak_remove_htable */
|
||||
void memleak_remove_htable(struct htable *memtable UNNEEDED, const struct htable *ht UNNEEDED)
|
||||
{ fprintf(stderr, "memleak_remove_htable called!\n"); abort(); }
|
||||
/* Generated stub for towire */
|
||||
void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED)
|
||||
{ fprintf(stderr, "towire called!\n"); abort(); }
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#include <common/setup.h>
|
||||
#include <stdio.h>
|
||||
|
||||
bool deprecated_apis = false;
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for any_channel_by_scid */
|
||||
struct channel *any_channel_by_scid(struct lightningd *ld UNNEEDED,
|
||||
@@ -163,6 +161,8 @@ void db_commit_transaction(struct db *db UNNEEDED)
|
||||
/* Generated stub for delete_channel */
|
||||
void delete_channel(struct channel *channel STEALS UNNEEDED)
|
||||
{ fprintf(stderr, "delete_channel called!\n"); abort(); }
|
||||
/* Generated stub for deprecated_apis */
|
||||
bool deprecated_apis;
|
||||
/* Generated stub for encode_scriptpubkey_to_addr */
|
||||
char *encode_scriptpubkey_to_addr(const tal_t *ctx UNNEEDED,
|
||||
const struct chainparams *chainparams UNNEEDED,
|
||||
|
||||
@@ -12,6 +12,8 @@ void db_begin_transaction_(struct db *db UNNEEDED, const char *location UNNEEDED
|
||||
/* Generated stub for db_commit_transaction */
|
||||
void db_commit_transaction(struct db *db UNNEEDED)
|
||||
{ fprintf(stderr, "db_commit_transaction called!\n"); abort(); }
|
||||
/* Generated stub for deprecated_apis */
|
||||
bool deprecated_apis;
|
||||
/* Generated stub for fatal */
|
||||
void fatal(const char *fmt UNNEEDED, ...)
|
||||
{ fprintf(stderr, "fatal called!\n"); abort(); }
|
||||
@@ -123,8 +125,6 @@ void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_node_id called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
bool deprecated_apis;
|
||||
|
||||
static int test_json_filter(void)
|
||||
{
|
||||
struct json_stream *result = new_json_stream(NULL, NULL, NULL);
|
||||
|
||||
@@ -40,13 +40,18 @@ if [ $# -eq 0 ]; then
|
||||
fi
|
||||
|
||||
for SYMBOL; do
|
||||
STUB=""
|
||||
# If there are multiple declarations, pick first (eg. common/memleak.h
|
||||
# has notleak_ as a declaration, and then an inline).
|
||||
# Also, prefer local headers over generic ones.
|
||||
WHERE=$(shopt -s nullglob; grep -nH "^[a-zA-Z0-9_ (),]* [*]*$SYMBOL(" "$UPDIRNAME"/*.h ./*/*.h | head -n1)
|
||||
if [ -z "$WHERE" ]; then
|
||||
echo "/* Could not find declaration for $SYMBOL */"
|
||||
continue
|
||||
WHERE=$(shopt -s nullglob; grep -nH "^extern [a-zA-Z0-9_ (),]* [*]*$SYMBOL;" "$UPDIRNAME"/*.h ./*/*.h | head -n1)
|
||||
STUB=";"
|
||||
if [ -z "$WHERE" ]; then
|
||||
echo "/* Could not find declaration for $SYMBOL */"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
FILE=${WHERE%%:*}
|
||||
@@ -55,13 +60,15 @@ for SYMBOL; do
|
||||
END=$(tail -n "+${LINE}" < "$FILE" | grep -n ';$');
|
||||
NUM=${END%%:*}
|
||||
|
||||
if grep -q "$SYMBOL.*mock empty" "$FILE"; then
|
||||
STUB="{ }"
|
||||
else
|
||||
# \n on RHS is a GNU extension, and we want to work on FreeBSD
|
||||
# shellcheck disable=SC1004
|
||||
STUB='\
|
||||
if [ -z "$STUB" ]; then
|
||||
if grep -q "$SYMBOL.*mock empty" "$FILE"; then
|
||||
STUB="{ }"
|
||||
else
|
||||
# \n on RHS is a GNU extension, and we want to work on FreeBSD
|
||||
# shellcheck disable=SC1004
|
||||
STUB='\
|
||||
{ fprintf(stderr, "'$SYMBOL' called!\\n"); abort(); }'
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "/* Generated stub for $SYMBOL */"
|
||||
|
||||
@@ -45,8 +45,6 @@ void db_fatal(const char *fmt, ...)
|
||||
#include <common/utils.h>
|
||||
#include <stdio.h>
|
||||
|
||||
bool deprecated_apis = true;
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for bigsize_put */
|
||||
size_t bigsize_put(u8 buf[BIGSIZE_MAX_LEN] UNNEEDED, bigsize_t v UNNEEDED)
|
||||
@@ -118,6 +116,8 @@ struct onionreply *create_onionreply(const tal_t *ctx UNNEEDED,
|
||||
const struct secret *shared_secret UNNEEDED,
|
||||
const u8 *failure_msg UNNEEDED)
|
||||
{ fprintf(stderr, "create_onionreply called!\n"); abort(); }
|
||||
/* Generated stub for deprecated_apis */
|
||||
bool deprecated_apis;
|
||||
/* Generated stub for derive_channel_id */
|
||||
void derive_channel_id(struct channel_id *channel_id UNNEEDED,
|
||||
const struct bitcoin_outpoint *outpoint UNNEEDED)
|
||||
|
||||
Reference in New Issue
Block a user