mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-06-28 21:39:25 +00:00
Simplify docker tests
This commit is contained in:
parent
690b086508
commit
7260cd6fe6
10
build.nims
10
build.nims
@ -92,16 +92,6 @@ task testNatPcpMapping, "Run PCP NAT integration test (requires miniupnpd contai
|
||||
putEnv("STORAGE_INTEGRATION_TEST_INCLUDES", "nat/testnatpcp.nim")
|
||||
test "testIntegration", outName = "testIntegrationNatPcp"
|
||||
|
||||
# Used to build the testing binaries in Docker
|
||||
task buildNatPortMappingBinaries, "Build UPnP and PCP NAT test binaries without running them":
|
||||
buildBinary "storage",
|
||||
outName = "storage",
|
||||
params = "-d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE"
|
||||
putEnv("STORAGE_INTEGRATION_TEST_INCLUDES", "nat/testnatupnp.nim")
|
||||
buildBinary "testIntegration", outName = "testIntegrationNat", srcDir = "tests/"
|
||||
putEnv("STORAGE_INTEGRATION_TEST_INCLUDES", "nat/testnatpcp.nim")
|
||||
buildBinary "testIntegration", outName = "testIntegrationNatPcp", srcDir = "tests/"
|
||||
|
||||
task build, "build Logos Storage binary":
|
||||
storageTask()
|
||||
|
||||
|
||||
@ -38,10 +38,9 @@ COPY library/ library/
|
||||
COPY tests/ tests/
|
||||
COPY build.nims config.nims storage.nim ./
|
||||
|
||||
# Build libplum C library and Nim binaries.
|
||||
# ccache caches C compilation across builds; nimcache caches Nim's generated C files.
|
||||
# Build libplum C library. Nim binaries are compiled at test runtime.
|
||||
# ccache caches C compilation across builds.
|
||||
RUN --mount=type=cache,target=/root/.ccache \
|
||||
--mount=type=cache,target=/app/nimcache \
|
||||
export PATH="/usr/lib/ccache:$PATH" && \
|
||||
rm -rf vendor/nim-libplum/vendor/libplum/build && \
|
||||
cmake -B vendor/nim-libplum/vendor/libplum/build \
|
||||
@ -49,9 +48,7 @@ RUN --mount=type=cache,target=/root/.ccache \
|
||||
vendor/nim-libplum/vendor/libplum && \
|
||||
make -j$(nproc) -C vendor/nim-libplum/vendor/libplum/build && \
|
||||
cp vendor/nim-libplum/vendor/libplum/build/libplum.a \
|
||||
vendor/nim-libplum/vendor/libplum/libplum.a && \
|
||||
USE_SYSTEM_NIM=1 vendor/nimbus-build-system/scripts/env.sh \
|
||||
nim buildNatPortMappingBinaries -d:debug -d:disable_libbacktrace build.nims
|
||||
vendor/nim-libplum/vendor/libplum/libplum.a
|
||||
|
||||
COPY tests/integration/nat/docker-entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
@ -45,17 +45,21 @@ EOF
|
||||
echo "miniupnpd started (pid $MINIUPNPD_PID)"
|
||||
}
|
||||
|
||||
export DEBUG=${DEBUG:-0}
|
||||
|
||||
if [[ "${TEST_PCP:-0}" == "1" ]]; then
|
||||
# PCP requires the UDP source IP to match the client_address in the MAP request.
|
||||
# Point the default route at LAN_IP so libplum uses it as both gateway and PCP target.
|
||||
ip route replace default via "$LAN_IP" dev "$LAN_IF"
|
||||
start_miniupnpd yes
|
||||
failed=0
|
||||
DEBUG=${DEBUG:-0} /app/build/testIntegrationNatPcp || failed=1
|
||||
USE_SYSTEM_NIM=1 vendor/nimbus-build-system/scripts/env.sh \
|
||||
nim testNatPcpMapping -d:debug -d:disable_libbacktrace build.nims || failed=1
|
||||
else
|
||||
start_miniupnpd no
|
||||
failed=0
|
||||
DEBUG=${DEBUG:-0} /app/build/testIntegrationNat || failed=1
|
||||
USE_SYSTEM_NIM=1 vendor/nimbus-build-system/scripts/env.sh \
|
||||
nim testNatPortMapping -d:debug -d:disable_libbacktrace build.nims || failed=1
|
||||
fi
|
||||
|
||||
if [[ "${DEBUG:-0}" == "1" ]]; then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user