Repository :
https://github.com/FarGroup/FarManager
On branch : master
Link :
https://github.com/FarGroup/FarManager/commit/08783f82ce991ca8dd20cd7a824b5cd9ece6583b
>---------------------------------------------------------------
commit 08783f82ce991ca8dd20cd7a824b5cd9ece6583b
Author: Alex Alabuzhev <
alab...@gmail.com>
Date: Mon Nov 10 21:19:16 2025 +0000
Enable unit tests in release builds (except for official)
>---------------------------------------------------------------
08783f82ce991ca8dd20cd7a824b5cd9ece6583b
appveyor.yml | 6 +++---
far/common/utility.hpp | 4 +++-
far/far.vcxproj | 2 +-
far/makefile_gcc | 2 --
far/makefile_vc | 6 +++---
misc/nightly/mysetnew.32.bat | 1 +
misc/nightly/mysetnew.64.bat | 1 +
misc/nightly/mysetnew.ARM64.bat | 1 +
8 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/appveyor.yml b/appveyor.yml
index 108227343..96fa0325b 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -45,7 +45,7 @@ environment:
configuration: Release
arch: amd64
platform_name: x64
- ADD_MAKE:
+ ADD_MAKE: ENABLE_TESTS=0
ADD_MAKE_MSI: RELEASE=1
NAME_ADD:
@@ -53,7 +53,7 @@ environment:
configuration: Release
arch: amd64_x86
platform_name: x86
- ADD_MAKE:
+ ADD_MAKE: ENABLE_TESTS=0
ADD_MAKE_MSI: RELEASE=1
NAME_ADD:
@@ -61,7 +61,7 @@ environment:
configuration: Release
arch: amd64_arm64
platform_name: ARM64
- ADD_MAKE:
+ ADD_MAKE: ENABLE_TESTS=0
ADD_MAKE_MSI: RELEASE=1
NAME_ADD:
diff --git a/far/common/utility.hpp b/far/common/utility.hpp
index b335ef0b9..4f5246f50 100644
--- a/far/common/utility.hpp
+++ b/far/common/utility.hpp
@@ -258,7 +258,9 @@ constexpr inline auto aligned_sizeof = aligned_size(sizeof(T), Alignment);
[[nodiscard]]
inline bool is_aligned(const void* Address, const size_t Alignment)
{
- return !(std::bit_cast<uintptr_t>(Address) % Alignment);
+ // Without volatile Clang may optimize the code away as otherwise it's UB
+ const volatile auto AddressValue = std::bit_cast<uintptr_t>(Address);
+ return !(AddressValue % Alignment);
}
template<typename T>
diff --git a/far/far.vcxproj b/far/far.vcxproj
index 669f7fbfe..a18aa2e1a 100644
--- a/far/far.vcxproj
+++ b/far/far.vcxproj
@@ -37,7 +37,7 @@ if not exist $(BootstrapDir) mkdir $(BootstrapDir)</Command>
</ClCompile>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug' or '$(Configuration)'=='Debug_ASAN'">
+ <ItemDefinitionGroup Condition="'$(EnableTests)'!='0' or '$(Configuration)'=='Debug' or '$(Configuration)'=='Debug_ASAN'">
<ClCompile>
<PreprocessorDefinitions>ENABLE_TESTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
diff --git a/far/makefile_gcc b/far/makefile_gcc
index 346145041..a35c6b82c 100644
--- a/far/makefile_gcc
+++ b/far/makefile_gcc
@@ -13,10 +13,8 @@ EXEFULLNAME = $(EXEDIR)$(EXENAME)
DEPFILE = $(BOOTSTRAPDIR)far.dep
ifndef ENABLE_TESTS
-ifdef DEBUG
ENABLE_TESTS = 1
endif
-endif
ifeq ($(ENABLE_TESTS),1)
CFLAGS += \
diff --git a/far/makefile_vc b/far/makefile_vc
index 38d5ec81a..496266505 100644
--- a/far/makefile_vc
+++ b/far/makefile_vc
@@ -41,7 +41,7 @@ ROOTDIR = ..
!include $(ROOTDIR)\_build\vc\config\common.mak
-!ifdef DEBUG
+!ifndef ENABLE_TESTS
ENABLE_TESTS=1
!endif
@@ -246,7 +246,7 @@ ADDINCLUDE=/I $(BOOTSTRAPDIR)..
CPPFLAGS = $(CPPFLAGS) $(ADDINCLUDE) /D "FAR_USE_INTERNALS"
RFLAGS = $(RFLAGS) $(ADDINCLUDE)
-!ifdef ENABLE_TESTS
+!if ("$(ENABLE_TESTS)" == "1")
CPPFLAGS = $(CPPFLAGS) /D "ENABLE_TESTS"
!endif
@@ -319,7 +319,7 @@ AllDirs:
@echo Fixing subsystem version
editbin /nologo /subsystem:console,$(OS_VERSION) /osversion:$(OS_VERSION) $(OUTDIR)\Far.exe > $(INTDIR)\version_fix.log
!endif
-!ifdef ENABLE_TESTS
+!if ("$(ENABLE_TESTS)" == "1")
@echo Running unit tests
$(OUTDIR)\Far.exe /service:test
!endif
diff --git a/misc/nightly/mysetnew.32.bat b/misc/nightly/mysetnew.32.bat
index 86cc59066..8a62330b3 100644
--- a/misc/nightly/mysetnew.32.bat
+++ b/misc/nightly/mysetnew.32.bat
@@ -1,3 +1,4 @@
call %~dp0base_32.bat
+set ENABLE_TESTS=0
nmake /f makefile_vc build USEDEPS=1
diff --git a/misc/nightly/mysetnew.64.bat b/misc/nightly/mysetnew.64.bat
index a41fc9c27..8f7e3a1b2 100644
--- a/misc/nightly/mysetnew.64.bat
+++ b/misc/nightly/mysetnew.64.bat
@@ -1,3 +1,4 @@
call %~dp0base_64.bat
+set ENABLE_TESTS=0
nmake /f makefile_vc build USEDEPS=1
diff --git a/misc/nightly/mysetnew.ARM64.bat b/misc/nightly/mysetnew.ARM64.bat
index 7b8d88c48..6948d5229 100644
--- a/misc/nightly/mysetnew.ARM64.bat
+++ b/misc/nightly/mysetnew.ARM64.bat
@@ -1,3 +1,4 @@
call %~dp0base_ARM64.bat
+set ENABLE_TESTS=0
nmake /f makefile_vc build USEDEPS=1