11.PHONY : statusgo all test clean help
22.PHONY : statusgo-ios-library statusgo-android-library
33.PHONY : build-libsds clean-libsds rebuild-libsds
4- .PHONY : clone-storage build-storage clean-storage test-storage
5- .PHONY : storage -help
4+ .PHONY : clone-storage build-storage clean-storage test-storage test-torrent
5+ .PHONY : history-archive -help
66
77# Clear any GOROOT set outside of the Nix shell
88export GOROOT =
@@ -107,7 +107,8 @@ BUILD_TAGS ?= gowaku_no_rln
107107# Pin nim-sds revision here. Can be a tag (default) or commit hash.
108108NIM_SDS_VERSION ?= v0.2.4
109109
110- # Option 1: Provide NIM_SDS_SOURCE_DIR. Make clones it if missing.
110+ # Option 1: Provide NIM_SDS_SOURCE_DIR. Make force-reclones a fresh copy (with submodules)
111+ # to guarantee a clean checkout on every build.
111112NIM_SDS_SOURCE_DIR ?= $(GIT_ROOT ) /../nim-sds
112113# Normalize path separators for Windows (backslashes cause issues when passed through shells)
113114ifeq ($(mkspecs ) ,win32)
@@ -137,10 +138,12 @@ CGO_LDFLAGS+=-L$(NIM_SDS_LIB_DIR) -lsds
137138
138139# `logos-storage` variables (opt-in)
139140USE_LOGOS_STORAGE ?= false
141+ USE_TORRENT ?= false
140142LOGOS_STORAGE_VERSION ?= 3c09f008bb5266a669fd19f18368f9e8b861b664
141143LOGOS_STORAGE_SOURCE_DIR ?= $(GIT_ROOT ) /../logos-storage-nim
142144
143- # Option 1: Provide LOGOS_STORAGE_SOURCE_DIR. Make clones it if missing.
145+ # Option 1: Provide LOGOS_STORAGE_SOURCE_DIR. Make force-reclones a fresh copy (with submodules)
146+ # to guarantee a clean checkout on every build.
144147# Option 2: Provide LOGOS_STORAGE_LIB_DIR and LOGOS_STORAGE_INC_DIR.
145148ifdef LOGOS_STORAGE_LIB_DIR
146149ifdef LOGOS_STORAGE_INC_DIR
@@ -159,28 +162,38 @@ LIBSTORAGE ?= $(LOGOS_STORAGE_LIB_DIR)/libstorage.$(LIB_EXT)
159162RUNTIME_LIB_DIRS := $(NIM_SDS_LIB_DIR )
160163LOGOS_STORAGE_BUILD_DEPS :=
161164ifeq ($(USE_LOGOS_STORAGE ) ,true)
162- BUILD_TAGS += use_logos_storage
165+ override BUILD_TAGS += use_logos_storage
163166 CGO_CFLAGS += -I$(LOGOS_STORAGE_INC_DIR)
164167 CGO_LDFLAGS += -L$(LOGOS_STORAGE_LIB_DIR) -lstorage -Wl,-rpath,$(LOGOS_STORAGE_LIB_DIR)
165168 RUNTIME_LIB_DIRS := $(LOGOS_STORAGE_LIB_DIR):$(RUNTIME_LIB_DIRS)
166169 LOGOS_STORAGE_BUILD_DEPS += $(LIBSTORAGE)
167170endif
168171
172+ ifeq ($(USE_TORRENT ) ,true)
173+ override BUILD_TAGS += use_torrent
174+ endif
175+
169176clone-storage : # #@build Clone or update logos-storage-nim
170177ifeq ($(LOGOS_STORAGE_BUILD_FROM_SOURCE ) ,true)
171178 @echo "Cloning or updating logos-storage-nim ..."
172179 if [ ! -d "$(LOGOS_STORAGE_SOURCE_DIR)" ]; then \
173- git clone --recurse-submodules https://github.com/logos-storage/logos-storage-nim.git $(LOGOS_STORAGE_SOURCE_DIR); \
180+ git clone --recurse-submodules https://github.com/logos-storage/logos-storage-nim.git " $(LOGOS_STORAGE_SOURCE_DIR)" ; \
174181 else \
175- cd $(LOGOS_STORAGE_SOURCE_DIR) && git fetch --tags; \
182+ cd " $(LOGOS_STORAGE_SOURCE_DIR)" && git fetch --tags; \
176183 fi
177- cd $(LOGOS_STORAGE_SOURCE_DIR) && git checkout $(LOGOS_STORAGE_VERSION) && git submodule update --init --recursive
184+ cd "$(LOGOS_STORAGE_SOURCE_DIR)" && \
185+ git switch --force --detach "$(LOGOS_STORAGE_VERSION)" && \
186+ git clean -fdx && \
187+ git submodule update --init --recursive --force
178188endif
179189
180190$(LIBSTORAGE ) : clone-storage
181191ifeq ($(LOGOS_STORAGE_BUILD_FROM_SOURCE ) ,true)
182192 @echo "Building logos-storage: $(LIBSTORAGE)"
183- $(MAKE) -C $(LOGOS_STORAGE_SOURCE_DIR) libstorage
193+ $(MAKE) -C $(LOGOS_STORAGE_SOURCE_DIR) libstorage USE_SYSTEM_NIM=$(USE_SYSTEM_NIM) SHELL=$(MAKE_SHELL)
194+ @test -f $(LIBSTORAGE) || (echo "Error: libstorage not found at $(LIBSTORAGE) after build" && exit 1)
195+ else
196+ @test -f $(LIBSTORAGE) || (echo "Error: libstorage not found at $(LIBSTORAGE)" && exit 1)
184197endif
185198
186199build-storage : $(LIBSTORAGE )
@@ -190,14 +203,29 @@ ifeq ($(LOGOS_STORAGE_BUILD_FROM_SOURCE),true)
190203 @rm -f "$(LOGOS_STORAGE_LIB_DIR)"/libstorage.*
191204endif
192205
193- test-storage : build-storage $(LIBSDS ) generate # #@tests Run logosstorage package tests via gotestsum
194- LD_LIBRARY_PATH=" $( LOGOS_STORAGE_LIB_DIR) :$( RUNTIME_LIB_DIRS) " \
206+ STORAGE_TEST_ENV := LD_LIBRARY_PATH="$(LOGOS_STORAGE_LIB_DIR ) :$(RUNTIME_LIB_DIRS ) " \
195207 CGO_LDFLAGS="$(CGO_LDFLAGS ) -L$(LOGOS_STORAGE_LIB_DIR ) -lstorage -Wl,-rpath,$(LOGOS_STORAGE_LIB_DIR ) " \
196- CGO_CFLAGS=" $( CGO_CFLAGS) -I$( LOGOS_STORAGE_INC_DIR) " \
197- gotestsum --packages=" ./services/logosstorage" -f testname -- -count 1 -tags " use_logos_storage $( BUILD_TAGS) gowaku_skip_migrations"
208+ CGO_CFLAGS="$(CGO_CFLAGS ) -I$(LOGOS_STORAGE_INC_DIR ) "
209+ STORAGE_TEST_TAGS := use_logos_storage $(BUILD_TAGS ) gowaku_skip_migrations
210+
211+ test-storage : build-storage $(LIBSDS ) generate # #@tests Run logosstorage package tests via gotestsum
212+ $(STORAGE_TEST_ENV ) gotestsum --packages=" ./services/logosstorage" -f testname -- -count 1 -tags " $( STORAGE_TEST_TAGS) "
213+ $(STORAGE_TEST_ENV ) gotestsum --packages=" ./protocol/communities/archive/logosstorage" -f testname -- -count 1 -tags " $( STORAGE_TEST_TAGS) "
214+ $(STORAGE_TEST_ENV ) gotestsum --packages=" ./protocol" -f testname -- -count 1 -tags " $( STORAGE_TEST_TAGS) " \
215+ -run TestMessengerCommunitiesTokenPermissionsSuite/TestUploadDownloadLogosStorageHistoryArchives
216+
217+ TORRENT_TEST_ENV := LD_LIBRARY_PATH="$(RUNTIME_LIB_DIRS ) " \
218+ CGO_LDFLAGS="$(CGO_LDFLAGS ) " \
219+ CGO_CFLAGS="$(CGO_CFLAGS ) "
220+ TORRENT_TEST_TAGS := $(BUILD_TAGS ) use_torrent gowaku_skip_migrations
221+
222+ test-torrent : $(LIBSDS ) generate # #@tests Run torrent archive package tests via gotestsum
223+ $(TORRENT_TEST_ENV ) gotestsum --packages=" ./protocol/communities/archive/torrent" -f testname -- -count 1 -tags " $( TORRENT_TEST_TAGS) "
224+ $(TORRENT_TEST_ENV ) gotestsum --packages=" ./protocol" -f testname -- -count 1 -tags " $( TORRENT_TEST_TAGS) " \
225+ -run TestMessengerCommunitiesTokenPermissionsSuite/TestImportDecryptedArchiveMessages
198226
199- storage- help : # #@build Show logos-storage build/test toggles and env vars
200- @cat services/logosstorage /README.md
227+ history-archive- help : # #@build Show history archive build/test toggles and env vars
228+ @cat protocol/communities/archive /README.md
201229
202230# mbedtls configuration for go-sqlcipher
203231ifeq ($(detected_OS ) ,Windows)
@@ -298,18 +326,22 @@ clone-nim-sds: ##@build Clone or update nim-sds
298326ifeq ($(NIM_SDS_BUILD_FROM_SOURCE ) ,true)
299327 @echo "Cloning or updating nim-sds ..."
300328 if [ ! -d "$(NIM_SDS_SOURCE_DIR)" ]; then \
301- git clone https://github.com/waku-org/nim-sds.git $(NIM_SDS_SOURCE_DIR); \
329+ git clone --recurse-submodules https://github.com/waku-org/nim-sds.git " $(NIM_SDS_SOURCE_DIR)" ; \
302330 else \
303- cd $(NIM_SDS_SOURCE_DIR) && git fetch --tags; \
331+ cd " $(NIM_SDS_SOURCE_DIR)" && git fetch --tags; \
304332 fi
305- cd $(NIM_SDS_SOURCE_DIR) && git checkout $(NIM_SDS_VERSION)
333+ cd "$(NIM_SDS_SOURCE_DIR)" && \
334+ git switch --force --detach "$(NIM_SDS_VERSION)" && \
335+ git clean -fdx && \
336+ git submodule update --init --recursive --force
306337endif
307338
308339$(LIBSDS ) : clone-nim-sds
309340ifeq ($(NIM_SDS_BUILD_FROM_SOURCE ) ,true)
310341 @echo "Building nim-sds: $(LIBSDS)"
311342 $(MAKE) -C $(NIM_SDS_SOURCE_DIR) update USE_SYSTEM_NIM=$(USE_SYSTEM_NIM)
312343 $(MAKE) -C $(NIM_SDS_SOURCE_DIR) libsds USE_SYSTEM_NIM=$(USE_SYSTEM_NIM) NIMFLAGS=-d:noSignalHandler SHELL=$(MAKE_SHELL)
344+ @test -f $(LIBSDS) || (echo "Error: libsds not found at $(LIBSDS) after build" && exit 1)
313345else
314346 @test -f $(LIBSDS) || (echo "Error: libsds not found at $(LIBSDS)" && exit 1)
315347endif
@@ -521,7 +553,7 @@ test-unit: ##@tests Run unit and integration tests
521553
522554test-single : test-unit-prep
523555 LD_LIBRARY_PATH=" $( RUNTIME_LIB_DIRS) " CGO_LDFLAGS=" $( CGO_LDFLAGS) " CGO_CFLAGS=" $( CGO_CFLAGS) " \
524- go test -v $( PKG ) -testify.m $( TEST )
556+ go test -v -tags ' $(BUILD_TAGS) ' $( PKG ) -run ' $(TEST) ' $( if $( TESTIFY_M ) ,- testify.m ' $( TESTIFY_M ) ' )
525557
526558test-unit-network : test-unit-prep
527559test-unit-network : export UNIT_TEST_RERUN_FAILS ?= false
@@ -536,6 +568,7 @@ test-functional: generate
536568test-functional : export FUNCTIONAL_TESTS_DOCKER_UID ?= $(call sh, id -u)
537569test-functional : export FUNCTIONAL_TESTS_REPORT_CODECOV ?= false
538570test-functional : export USE_LOGOS_STORAGE := $(USE_LOGOS_STORAGE )
571+ test-functional : export USE_TORRENT := $(USE_TORRENT )
539572test-functional :
540573 @./scripts/run_functional_tests.sh
541574
@@ -544,7 +577,7 @@ test-functional-compatibility: export FUNCTIONAL_TESTS_DOCKER_UID ?= $(call sh,
544577test-functional-compatibility : export FUNCTIONAL_TESTS_REPORT_CODECOV ?= false
545578test-functional-compatibility : export USE_LOGOS_STORAGE := $(USE_LOGOS_STORAGE )
546579test-functional-compatibility : export FUNCTIONAL_TESTS_MARKER := compatibility
547- test-functional-compatibility : export FUNCTIONAL_TESTS_RERUNS := 1
580+ test-functional-compatibility : export FUNCTIONAL_TESTS_RERUNS := 6
548581test-functional-compatibility : # #@tests Cross-version chat compatibility smoke tests (set PEER_IMAGES or PEER_REFS)
549582 @./scripts/run_functional_tests.sh
550583
0 commit comments