[Buildroot] [git commit branch/2025.02.x] support/testing: TestOpenJdk: remove stime() function call
Thomas Perale
thomas.perale at mind.be
Thu Sep 11 15:42:42 UTC 2025
commit: https://git.buildroot.net/buildroot/commit/?id=c50e95e02688ee4b75585bbecfbd70987fa8c73d
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2025.02.x
stime() has been deprecated in glibc 2.31 [1] and replaced with
clock_settime(). Let's replace the stime() function call used in
BR2_PACKAGE_OPENJDK_JNI_TEST sources with clock_settime().
Apply the same change as busybox [2]. Make sure that timeToSet
has been zeroed.
With that fixed, the test "Call Native Library to Set System Time"
succeed:
[BRTEST# java -cp /usr/bin JniTest
Test: Get JNI Version passed
Test: Read Native String Constant passed
Test: Write Java String to Native Library passed
Test: Write Java Char Array to Native Library passed
Test: Write String Member to Native Library passed
Test: Set String Member from Native Library passed
Test: Execeute Java Function from Native Library passed
Test: Instantiate Java Class passed
Test: Call Native Library to Set System Time passed
[BRTEST# echo $?
0
The last external toolchain using a glibc 2.30 was the Bootlin
aarch64--glibc--bleeding-edge-2020.02-2, so since then TestOpenJdk
is broken.
Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/11176774851
[1] https://lists.gnu.org/archive/html/info-gnu/2020-02/msg00001.html
[2] https://git.busybox.net/busybox/commit/?id=d3539be8f27b8cbfdfee460fe08299158f08bcd9
[3] https://toolchains.bootlin.com/downloads/releases/toolchains/aarch64/readmes/aarch64--glibc--bleeding-edge-2020.02-2.txt
Signed-off-by: Romain Naour <romain.naour at smile.fr>
Signed-off-by: Julien Olivain <ju.o at free.fr>
(cherry picked from commit 681b92664da62f807f836a8c28ecbf54b7ca6818)
Signed-off-by: Thomas Perale <thomas.perale at mind.be>
---
.../package/br2-external/openjdk/package/openjdk-jni-test/native.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/support/testing/tests/package/br2-external/openjdk/package/openjdk-jni-test/native.c b/support/testing/tests/package/br2-external/openjdk/package/openjdk-jni-test/native.c
index ed87e345af..9e926a27d9 100644
--- a/support/testing/tests/package/br2-external/openjdk/package/openjdk-jni-test/native.c
+++ b/support/testing/tests/package/br2-external/openjdk/package/openjdk-jni-test/native.c
@@ -29,8 +29,10 @@ void execute_function(void(*function)(void*), void* context)
}
void set_time_in_seconds(int seconds)
{
- time_t timeToSet = seconds;
- stime(&timeToSet);
+ struct timespec timeToSet = { 0, 0 };
+
+ timeToSet.tv_sec = seconds;
+ clock_settime(CLOCK_REALTIME, &timeToSet);
}
void write_internal_time_in_seconds()
{
More information about the buildroot
mailing list