Skip to contentSkip to conversation

package/ltp-testsuite: Fix m68k build

PATCH New Petr Vorel 3 participants 4 messages Oct 2, 2020 – Oct 10, 2020

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/2 package/ltp-testsuite: Fix m68k build

Backport upstream proposal for fix.

Fixes br-m68k-68040-full failure.

---
I haven't found this in autobuild [1], there are just problems with fanotify tests missing MAX_HANDLE_SZ, which are fixed in next version (second patch).

Kind regards,
Petr

[1] http://autobuild.buildroot.net/index.php?reason=ltp-testsuite-20200515

 ...01-cacheflush01-Rewrite-into-new-API.patch | 225 ++++++++++++++++++
 1 file changed, 225 insertions(+)
 create mode 100644 package/ltp-testsuite/0001-cacheflush01-Rewrite-into-new-API.patch
package/ltp-testsuite/0001-cacheflush01-Rewrite-into-new-API.patch new file +225 -0
new file mode 100644
index 0000000000..f9815624b9
@@ -0,0 +1,225 @@
+From 48edd768850825a4d01e5e5e737122333fc55cdf Mon Sep 17 00:00:00 2001
+From: Petr Vorel <[email protected]>
+Date: Fri, 2 Oct 2020 21:29:58 +0200
+Subject: [PATCH] cacheflush01: Rewrite into new API
+
+This syscall is currently (v5.9) supported on these architectures:
+arc, csky, mips, m68k, nds32, sh
+
+constants are missing for m68k, not sure if the testcase is valid for it.
+Untested.
+
+Test for __LTP__NR_INVALID_SYSCALL saves adding autotools check for
+<asm/cachectl.h>.
+
+Signed-off-by: Petr Vorel <[email protected]>
+---
+[ upstream status: https://patchwork.ozlabs.org/project/ltp/patch/20201002202416.28972-1-petr.vorel at gmail.com/ ]
+ .../kernel/syscalls/cacheflush/cacheflush01.c | 173 ++++--------------
+ 1 file changed, 40 insertions(+), 133 deletions(-)
+
+diff --git a/testcases/kernel/syscalls/cacheflush/cacheflush01.c b/testcases/kernel/syscalls/cacheflush/cacheflush01.c
+index 29cf2014a..6ad8b953a 100644
+--- a/testcases/kernel/syscalls/cacheflush/cacheflush01.c
++++ b/testcases/kernel/syscalls/cacheflush/cacheflush01.c
+@@ -1,157 +1,64 @@
+-/******************************************************************************/
+-/* Copyright (c) Maxin John <[email protected]>, 2009                      */
+-/* LKML Reference: http://lkml.org/lkml/2009/4/9/203                          */
+-/* This program is free software;  you can redistribute it and/or modify      */
+-/* it under the terms of the GNU General Public License as published by       */
+-/* the Free Software Foundation; either version 2 of the License, or          */
+-/* (at your option) any later version.                                        */
+-/*                                                                            */
+-/* This program is distributed in the hope that it will be useful,            */
+-/* but WITHOUT ANY WARRANTY;  without even the implied warranty of            */
+-/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See                  */
+-/* the GNU General Public License for more details.                           */
+-/*                                                                            */
+-/* You should have received a copy of the GNU General Public License          */
+-/* along with this program;  if not, write to the Free Software               */
+-/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    */
+-/*                                                                            */
+-/******************************************************************************/
+-/******************************************************************************/
+-/*                                                                            */
+-/* File:        cacheflush01.c                                                */
+-/*                                                                            */
+-/* Description: The cacheflush_check() syscall                     	      */
+-/*		Tests EINVAL error of cacheflush system call.		      */
+-/* 		Its expected behaviour is cacheflush() should return -EINVAL  */
+-/*		when cache parameter is not one of ICACHE, DCACHE, or BCACHE. */
+-/*                                                                            */
+-/* Usage:  <for command-line>                                                 */
+-/* cacheflush01 [-c n] [-e][-i n] [-I x] [-p x] [-t]                          */
+-/*      where,  -c n : Run n copies concurrently.                             */
+-/*              -e   : Turn on errno logging.                                 */
+-/*              -i n : Execute test n times.                                  */
+-/*              -I x : Execute test for x seconds.                            */
+-/*              -P x : Pause for x seconds between iterations.                */
+-/*              -t   : Turn on syscall timing.                                */
+-/*                                                                            */
+-/* Total Tests: 1                                                             */
+-/*                                                                            */
+-/* Test Name:   cacheflush01                                                  */
+-/******************************************************************************/
++// SPDX-License-Identifier: GPL-2.0-or-later
+ 
+-#include <unistd.h>
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <errno.h>
+-
+-#include "test.h"
++#include "tst_test.h"
+ #include "lapi/syscalls.h"
+ 
+ #if __NR_cacheflush != __LTP__NR_INVALID_SYSCALL
++
+ #include <asm/cachectl.h>
+-#else
++
++/*
++ * m68k does not have these constants
++ */
++
+ #ifndef   ICACHE
+-#define   ICACHE   (1<<0)	/* flush instruction cache        */
++# define   ICACHE   (1<<0)
+ #endif
++
+ #ifndef   DCACHE
+-#define   DCACHE   (1<<1)	/* writeback and flush data cache */
++# define   DCACHE   (1<<1)
+ #endif
++
+ #ifndef   BCACHE
+-#define   BCACHE   (ICACHE|DCACHE)	/* flush both caches              */
+-#endif
++# define   BCACHE   (ICACHE|DCACHE)
+ #endif
+ 
+-char *TCID = "cacheflush01";
+-int TST_TOTAL = 1;
++#define CACHE_DESC(x) .cache = x, .desc = #x
+ 
+-/* Extern Global Functions */
+-/******************************************************************************/
+-/*                                                                            */
+-/* Function:    cleanup                                                       */
+-/*                                                                            */
+-/* Description: Performs all one time clean up for this test on successful    */
+-/*              completion,  premature exit or  failure. Closes all temporary */
+-/*              files, removes all temporary directories exits the test with  */
+-/*              appropriate return code by calling tst_exit() function.       */
+-/*                                                                            */
+-/* Input:       None.                                                         */
+-/*                                                                            */
+-/* Output:      None.                                                         */
+-/*                                                                            */
+-/* Return:      On failure - Exits calling tst_exit(). Non '0' return code.   */
+-/*              On success - Exits calling tst_exit(). With '0' return code.  */
+-/*                                                                            */
+-/******************************************************************************/
+-void cleanup(void)
+-{
++static struct test_case_t {
++	int cache;
++	const char *desc;
++} test_cases[] = {
++	{ CACHE_DESC(ICACHE) },
++	{ CACHE_DESC(DCACHE) },
++	{ CACHE_DESC(BCACHE) },
++};
+ 
+-	tst_rmdir();
+-}
++static char *addr;
+ 
+-/* Local  Functions */
+-/******************************************************************************/
+-/*                                                                            */
+-/* Function:    setup                                                         */
+-/*                                                                            */
+-/* Description: Performs all one time setup for this test. This function is   */
+-/*              typically used to capture signals, create temporary dirs      */
+-/*              and temporary files that may be used in the course of this    */
+-/*              test.                                                         */
+-/*                                                                            */
+-/* Input:       None.                                                         */
+-/*                                                                            */
+-/* Output:      None.                                                         */
+-/*                                                                            */
+-/* Return:      On failure - Exits by calling cleanup().                      */
+-/*              On success - returns 0.                                       */
+-/*                                                                            */
+-/******************************************************************************/
+-void setup(void)
++static void setup(void)
+ {
+-	/* Capture signals if any */
+-	/* Create temporary directories */
+-	TEST_PAUSE;
+-	tst_tmpdir();
++	addr = SAFE_MALLOC(getpagesize());
+ }
+ 
+-int main(int ac, char **av)
++static void test_cacheflush(unsigned int i)
+ {
++	struct test_case_t *tc = &test_cases[i];
+ 
+-	char *addr = NULL;
+-
+-	tst_parse_opts(ac, av, NULL, NULL);
+-
+-	setup();
+-
+-	tst_count = 0;
+-	/* Create some user address range */
+-	addr = malloc(getpagesize());
+-	if (addr == NULL) {
+-		tst_brkm(TFAIL | TTERRNO, cleanup, "malloc failed");
+-	}
+-
+-	/* Invokes cacheflush() with proper parameters */
+-	TEST(ltp_syscall(__NR_cacheflush, addr, getpagesize(), ICACHE));
+-	if (TEST_RETURN == 0) {
+-		tst_resm(TPASS, "passed with no errno");
+-	} else {
+-		tst_resm(TFAIL, "failed with unexpected errno");
+-	}
+-
+-	TEST(ltp_syscall(__NR_cacheflush, addr, getpagesize(), DCACHE));
+-	if (TEST_RETURN == 0) {
+-		tst_resm(TPASS, "passed with no errno");
++	TEST(tst_syscall(__NR_cacheflush, addr, getpagesize(), tc->cache));
++	if (TST_RET == 0) {
++		tst_res(TPASS, "%s passed", tc->desc);
+ 	} else {
+-		tst_resm(TFAIL, "failed with unexpected errno");
++		tst_res(TFAIL | TTERRNO, "%s failed", tc->desc);
+ 	}
++}
+ 
+-	TEST(ltp_syscall(__NR_cacheflush, addr, getpagesize(), BCACHE));
+-	if (TEST_RETURN == 0) {
+-		tst_resm(TPASS, "passed with no errno");
+-	} else {
+-		tst_resm(TFAIL, "failed with unexpected errno");
+-	}
++static struct tst_test test = {
++	.setup = setup,
++	.test = test_cacheflush,
++	.tcnt = ARRAY_SIZE(test_cases),
++};
+ 
+-	cleanup();
+-	tst_exit();
+-}
++#else
++	TST_TEST_TCONF("system doesn't support cacheflush()");
++#endif
+-- 
+2.28.0
+
Signature · 1 line
2.28.0
author
#1 lore raw

PATCH 2/2 package/ltp-testsuite: bump to version 20200930

Drop patch form this version add 2 new patches for fixing build.

---
 ...001-fanotify.h-fix-build-with-uclibc.patch |  41 ----
 ...ysinfo.h-to-fix-build-with-MUSL-libc.patch | 203 ++++++++++++++++++
 package/ltp-testsuite/ltp-testsuite.hash      |   4 +-
 package/ltp-testsuite/ltp-testsuite.mk        |   2 +-
 4 files changed, 206 insertions(+), 44 deletions(-)
 delete mode 100644 package/ltp-testsuite/0001-fanotify.h-fix-build-with-uclibc.patch
 create mode 100644 package/ltp-testsuite/0002-lapi-Add-sysinfo.h-to-fix-build-with-MUSL-libc.patch
package/ltp-testsuite/0001-fanotify.h-fix-build-with-uclibc.patch deleted +0 -41
deleted file mode 100644
index 5531756970..0000000000
@@ -1,41 +0,0 @@
-From cb11e718ce04261cb6ff4c09442b949da33b8797 Mon Sep 17 00:00:00 2001
-From: Fabrice Fontaine <[email protected]>
-Date: Sat, 5 Sep 2020 17:55:45 +0200
-Subject: [PATCH] fanotify.h: fix build with uclibc
-
-MAX_HANDLE_SZ is used since version 20200515 and
-https://github.com/linux-test-project/ltp/commit/d20a3e8f9a794e0659277acfa9fbcf7454ba4631
-
-However, it is not defined by uclibc, so define it if needed to avoid
-the following build failure:
-
-fanotify.h:171:11: error: 'MAX_HANDLE_SZ' undeclared here (not in a function)
-  171 |  char buf[MAX_HANDLE_SZ];
-
-Fixes:
- - http://autobuild.buildroot.org/results/fb0a67b15482e76b379b4b4d9c43b45bb0fccae1
-
-Signed-off-by: Fabrice Fontaine <[email protected]>
-Reviewed-by: Cyril Hrubis <[email protected]>
-[Retrieved from:
-https://github.com/linux-test-project/ltp/commit/cb11e718ce04261cb6ff4c09442b949da33b8797]
----
- testcases/kernel/syscalls/fanotify/fanotify.h | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
-index a9a431ca2f..d271578e97 100644
---- a/testcases/kernel/syscalls/fanotify/fanotify.h
-+++ b/testcases/kernel/syscalls/fanotify/fanotify.h
-@@ -139,6 +139,11 @@ struct fanotify_event_info_fid {
- #endif /* HAVE_STRUCT_FANOTIFY_EVENT_INFO_FID_FSID___VAL */
- 
- #ifdef HAVE_NAME_TO_HANDLE_AT
-+
-+#ifndef MAX_HANDLE_SZ
-+#define MAX_HANDLE_SZ		128
-+#endif
-+
- /*
-  * Helper function used to obtain fsid and file_handle for a given path.
-  * Used by test files correlated to FAN_REPORT_FID functionality.
package/ltp-testsuite/0002-lapi-Add-sysinfo.h-to-fix-build-with-MUSL-libc.patch new file +203 -0

203 lines not on this page · raw message

package/ltp-testsuite/ltp-testsuite.hash +2 -2
index eb349e2929..9dce0405df 100644
@@ -1,4 +1,4 @@
-# From: https://github.com/linux-test-project/ltp/releases/download/20200515/ltp-full-20200515.tar.xz.sha1
-sha1 7b3932b46295328c64d6f235bc54fa68806b9ede  ltp-full-20200515.tar.xz
+# From: https://github.com/linux-test-project/ltp/releases/download/20200930/ltp-full-20200930.tar.xz.sha1
+sha1 f380c7afe71e03eabb1de668c0399267042cb0f7  ltp-full-20200930.tar.xz
 # Locally computed
 sha256  8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING
package/ltp-testsuite/ltp-testsuite.mk +1 -1
index 4cee77bcd0..a9a3173c4b 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-LTP_TESTSUITE_VERSION = 20200515
+LTP_TESTSUITE_VERSION = 20200930
 LTP_TESTSUITE_SOURCE = ltp-full-$(LTP_TESTSUITE_VERSION).tar.xz
 LTP_TESTSUITE_SITE = https://github.com/linux-test-project/ltp/releases/download/$(LTP_TESTSUITE_VERSION)
 LTP_TESTSUITE_LICENSE = GPL-2.0, GPL-2.0+
Signature · 1 line
2.28.0
#2 lore raw

PATCH 1/2 package/ltp-testsuite: Fix m68k build

In reply to Petr Vorel
Quoted 9 lines · On Sat, 3 Oct 2020 00:10:31 +0200 Petr Vorel <[email protected]> wrote:

Backport upstream proposal for fix.

Fixes br-m68k-68040-full failure.

---
I haven't found this in autobuild [1], there are just problems with fanotify tests missing MAX_HANDLE_SZ, which are fixed in next version (second patch).

Series applied, thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com