@@ -10,14 +10,14 @@ if [ ! -d "$1/lightning" -o "$2" != "true" -a "$2" != "false" ]; then
10
10
fi
11
11
12
12
SKIP_TESTS_ARGUMENT=$3
13
- SKIP_TESTS=false
13
+ RUN_CPP_TESTS=true
14
14
15
15
if [ ! -z " $SKIP_TESTS_ARGUMENT " ]; then
16
16
if [ " $SKIP_TESTS_ARGUMENT " != " skip-tests" ]; then
17
17
echo " To skip tests, usage must be: $0 path-to-rust-lightning allow-std skip-tests"
18
18
exit 1
19
19
else
20
- SKIP_TESTS=true
20
+ RUN_CPP_TESTS=false
21
21
fi
22
22
fi
23
23
@@ -329,45 +329,45 @@ export IFS="$OLD_IFS"
329
329
set -x
330
330
mv include/lightningpp_new.hpp include/lightningpp.hpp
331
331
332
- if $SKIP_TESTS ; then
333
- echo " Skipping tests!"
334
- exit 0
335
- fi
332
+ if $RUN_CPP_TESTS ; then
333
+ # Finally, sanity-check the generated C and C++ bindings with demo apps:
334
+ # Naively run the C demo app:
335
+ gcc $LOCAL_CFLAGS -Wall -g -pthread demo.c target/debug/libldk.a -ldl -lm
336
+ ./a.out
336
337
337
- # Finally, sanity-check the generated C and C++ bindings with demo apps:
338
- # Naively run the C demo app:
339
- gcc $LOCAL_CFLAGS -Wall -g -pthread demo.c target/debug/libldk.a -ldl -lm
340
- ./a.out
338
+ # And run the C++ demo app
339
+ if [ " $2 " = " true" ]; then
340
+ g++ $LOCAL_CFLAGS -std=c++11 -Wall -g -pthread demo.cpp -Ltarget/debug/ -lldk -ldl
341
+ LD_LIBRARY_PATH=target/debug/ ./a.out > /dev/null
342
+ fi
341
343
342
- # And run the C++ demo app
343
- if [ " $2 " = " true" ]; then
344
- g++ $LOCAL_CFLAGS -std=c++11 -Wall -g -pthread demo.cpp -Ltarget/debug/ -lldk -ldl
345
- LD_LIBRARY_PATH=target/debug/ ./a.out > /dev/null
346
- fi
344
+ # Finally, run the C++ demo app with our native networking library
345
+ # in valgrind to test memory model correctness and lack of leaks.
346
+ gcc $LOCAL_CFLAGS -fPIC -std=c99 -Wall -g -pthread -I../ldk-net ../ldk-net/ldk_net.c -c -o ldk_net.o
347
+ if [ " $2 " = " true" ]; then
348
+ g++ $LOCAL_CFLAGS -std=c++11 -Wall -g -pthread -DREAL_NET -I../ldk-net ldk_net.o demo.cpp target/debug/libldk.a -ldl -lm
349
+ if [ -x " ` which valgrind` " -a " $( uname -m) " != " ppc64le" ]; then
350
+ valgrind --error-exitcode=4 --memcheck:leak-check=full --show-leak-kinds=all ./a.out
351
+ echo
352
+ else
353
+ echo " WARNING: Please install valgrind for more testing"
354
+ ./a.out
355
+ fi
356
+ fi
347
357
348
- # Finally, run the C++ demo app with our native networking library
349
- # in valgrind to test memory model correctness and lack of leaks.
350
- gcc $LOCAL_CFLAGS -fPIC -std=c99 -Wall -g -pthread -I../ldk-net ../ldk-net/ldk_net.c -c -o ldk_net.o
351
- if [ " $2 " = " true" ]; then
352
- g++ $LOCAL_CFLAGS -std=c++11 -Wall -g -pthread -DREAL_NET -I../ldk-net ldk_net.o demo.cpp target/debug/libldk.a -ldl -lm
353
- if [ -x " ` which valgrind` " -a " $( uname -m) " != " ppc64le" ]; then
354
- valgrind --error-exitcode=4 --memcheck:leak-check=full --show-leak-kinds=all ./a.out
355
- echo
356
- else
357
- echo " WARNING: Please install valgrind for more testing"
358
- ./a.out
359
- fi
360
- fi
361
358
359
+ # Test a statically-linked C++ version, tracking the resulting binary size and runtime
360
+ # across debug, LTO, and cross-language LTO builds (using the same compiler each time).
361
+ if [ " $2 " = " true" ]; then
362
+ clang++ $LOCAL_CFLAGS -std=c++11 demo.cpp target/debug/libldk.a -ldl
363
+ strip ./a.out
364
+ time ./a.out
365
+ echo " C++ Bin size and runtime w/o optimization:"
366
+ ls -lha a.out
367
+ fi
362
368
363
- # Test a statically-linked C++ version, tracking the resulting binary size and runtime
364
- # across debug, LTO, and cross-language LTO builds (using the same compiler each time).
365
- if [ " $2 " = " true" ]; then
366
- clang++ $LOCAL_CFLAGS -std=c++11 demo.cpp target/debug/libldk.a -ldl
367
- strip ./a.out
368
- time ./a.out
369
- echo " C++ Bin size and runtime w/o optimization:"
370
- ls -lha a.out
369
+ else
370
+ echo " Skipping tests!"
371
371
fi
372
372
373
373
function REALLY_PIN_CC {
0 commit comments