Add patch to fix build on arm32

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-12-21 23:08:20 +01:00
parent 47d443ea5d
commit 4100d92c45
2 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,55 @@
From 034967a2a644c8cdbf855f0079299b71b6a1f435 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 21 Dec 2018 22:49:53 +0100
Subject: [PATCH] test-json: check absolute and relative difference in floating
point test
The test fails under valgrind, so there was an exception for valgrind.
Unfortunately that check only works when valgrind-devel headers are
available during build. But it is possible to have just valgrind installed,
or simply install it after the build, and then "valgrind test-json" would
fail.
It also seems that even without valgrind, this fails on some arm32 CPUs.
Let's do the usual-style test for absolute and relative differences.
---
src/test/test-json.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/test/test-json.c b/src/test/test-json.c
index 5aa4d19dbe..e6ec9bfba8 100644
--- a/src/test/test-json.c
+++ b/src/test/test-json.c
@@ -1,9 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <math.h>
-#if HAVE_VALGRIND_VALGRIND_H
-#include <valgrind/valgrind.h>
-#endif
#include "alloc-util.h"
#include "fd-util.h"
@@ -45,12 +42,13 @@ static void test_tokenizer(const char *data, ...) {
d = va_arg(ap, long double);
-#if HAVE_VALGRIND_VALGRIND_H
- if (!RUNNING_ON_VALGRIND)
-#endif
- /* Valgrind doesn't support long double calculations and automatically downgrades to 80bit:
- * http://www.valgrind.org/docs/manual/manual-core.html#manual-core.limits */
- assert_se(fabsl(d - v.real) < 0.001L);
+ /* Valgrind doesn't support long double calculations and automatically downgrades to 80bit:
+ * http://www.valgrind.org/docs/manual/manual-core.html#manual-core.limits.
+ * Some architectures might now support long double either.
+ */
+
+ assert_se(fabsl(d - v.real) < 1e-15 ||
+ fabsl(d - v.real) / v.real < 1e-15);
} else if (t == JSON_TOKEN_INTEGER) {
intmax_t i;
--
2.19.2

View File

@ -50,6 +50,8 @@ i=1; for j in 00*patch; do printf "Patch%04d: %s\n" $i $j; i=$((i+1));done|
GIT_DIR=../../src/systemd/.git git diffab -M v233..master@{2017-06-15} -- hwdb/[67]* hwdb/parse_hwdb.py > hwdb.patch
%endif
Patch0001: 0001-test-json-check-absolute-and-relative-difference-in-.patch
Patch0998: 0998-resolved-create-etc-resolv.conf-symlink-at-runtime.patch
%ifarch %{ix86} x86_64 aarch64