aboutsummaryrefslogtreecommitdiffstats
path: root/Configurations
diff options
context:
space:
mode:
authorJakub Zelenka <[email protected]>2026-06-11 19:05:43 +0200
committerTomas Mraz <[email protected]>2026-07-15 18:00:29 +0200
commit857afd02b282314687bc1290d7d12a313d3b9f85 (patch)
treef135c8b852deba61d5e2aaf50a4d0abf94c67188 /Configurations
parentkeccak1600x4-avx512vl: fix undefined symbols on macOS (diff)
downloadopenssl-857afd02b282314687bc1290d7d12a313d3b9f85.tar.gz
openssl-857afd02b282314687bc1290d7d12a313d3b9f85.zip
test: add Windows unit tests setup and initial dgram test
This adds an initial setup for unit testing on Windows that allows mocking of system functions using Detour library. This works only for library functions and not object function like wrap so it is a bit limited but it is still useful for BIO mocking. An initial BIO bss_dgram test is added covering the Windows specific parts. Assisted-by: Claude:claude-opus-4-8 Reviewed-by: Igor Ustinov <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> MergeDate: Wed Jul 15 16:00:35 2026 (Merged from https://github.com/openssl/openssl/pull/31915)
Diffstat (limited to 'Configurations')
-rw-r--r--Configurations/unix-Makefile.tmpl15
-rw-r--r--Configurations/windows-makefile.tmpl8
2 files changed, 15 insertions, 8 deletions
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index f8e44e73f7d..0d4ec0f983f 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -505,6 +505,7 @@ BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
CMOCKA_LIBS={- $config{cmocka_libs} // '' -}
+DETOURS_LIBS={- $config{detours_libs} // '' -}
# CPPFLAGS_Q is used for one thing only: to build up buildinf.h
CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
@@ -2024,14 +2025,14 @@ EOF
}
}
my $wrapflags = '';
- my $cmocka = '';
if (defined $unified_info{wraps}->{$args{bin}}) {
- $wrapflags = join(' ',
- map { "-Wl,--wrap=$_" }
- @{$unified_info{wraps}->{$args{bin}}});
- $wrapflags = ' ' . $wrapflags;
- $cmocka = ' $(CMOCKA_LIBS)';
+ $wrapflags = ' ' . join(' ',
+ map { "-Wl,--wrap=$_" }
+ @{$unified_info{wraps}->{$args{bin}}});
}
+ my $utlibs = $unified_info{unit_test_libs}->{$args{bin}};
+ $utlibs = $utlibs ne '' ? ' ' . $utlibs : '' if defined $utlibs;
+ $utlibs //= '';
my $linkflags = join("", map { $_." " } @linkdirs);
my $linklibs = join("", map { $_." " } @linklibs);
my $cmd = '$(CC)';
@@ -2052,7 +2053,7 @@ $bin: $deps
\$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS)$wrapflags \\
-o $bin \\
$objs \\
- $linklibs\$(BIN_EX_LIBS)$cmocka
+ $linklibs\$(BIN_EX_LIBS)$utlibs
EOF
}
sub in2script {
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
index 16fed4670d8..a7f2b6652b1 100644
--- a/Configurations/windows-makefile.tmpl
+++ b/Configurations/windows-makefile.tmpl
@@ -380,6 +380,9 @@ BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
'$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
+CMOCKA_LIBS={- $config{cmocka_libs} // '' -}
+DETOURS_LIBS={- $config{detours_libs} // '' -}
+
# CPPFLAGS_Q is used for one thing only: to build up buildinf.h
CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
$cppflags2 =~ s|([\\"])|\\$1|g;
@@ -1001,11 +1004,14 @@ EOF
my $ress = join($target{ld_resp_delim}, @ress);
my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps);
my $deps = join(" ", @objs, @ress, @deps);
+ my $utlibs = $unified_info{unit_test_libs}->{$args{bin}};
+ $utlibs = (defined $utlibs && $utlibs ne '')
+ ? "$utlibs$target{ld_resp_delim}" : '';
return <<"EOF";
$bin: $deps
IF EXIST $bin.manifest DEL /F /Q $bin.manifest
\$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) @<<
-$objs$target{ld_resp_delim}\$(LDOUTFLAG)$bin$target{ldpostoutflag}$target{ld_resp_delim}$linklibs\$(BIN_EX_LIBS)$target{ldresflag}$target{ldresflag}$ress
+$objs$target{ld_resp_delim}\$(LDOUTFLAG)$bin$target{ldpostoutflag}$target{ld_resp_delim}$utlibs$linklibs\$(BIN_EX_LIBS)$target{ldresflag}$target{ldresflag}$ress
<<
IF EXIST $bin.manifest \\
\$(MT) \$(MTFLAGS) \$(MTINFLAG)$bin.manifest \$(MTOUTFLAG)$bin