Skip to contentSkip to conversation

splice02: Generate input in C

PATCH New Petr Vorel 2 participants 4 messages Apr 23, 2021 – Apr 26, 2021

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH v6 1/2 splice02: Generate input in C

instead relying on shell piping data into it.

Check resulted file size and content. Also add metadata docs.

Problem found on SLES JeOS (https://progress.opensuse.org/issues/77260).

[ chrubis: while loop simplification ]

---
changes v5->v6:
* use check loop suggested by Cyril (using LTP_ALIGN(), that required to change writing splice())
* fix missing goto

 runtest/smoketest                           |   2 +-
 runtest/syscalls                            |   2 +-
 testcases/kernel/syscalls/splice/splice02.c | 146 ++++++++++++++++++--
 3 files changed, 137 insertions(+), 13 deletions(-)
runtest/smoketest +1 -1
index 0c24fc1fa..2224d8f74 100644
@@ -11,5 +11,5 @@ symlink01 symlink01
 stat04 symlink01 -T stat04
 utime01A symlink01 -T utime01
 rename01A symlink01 -T rename01
-splice02 seq 1 20 | splice02
+splice02 splice02 -s 20
 route4-change-dst route-change-dst.sh
runtest/syscalls +1 -1
index 2d1e7b648..b89c545f0 100644
@@ -1451,7 +1451,7 @@ socketpair02 socketpair02
 sockioctl01 sockioctl01
 
 splice01 splice01
-splice02 seq 1 20000 | splice02
+splice02 splice02
 splice03 splice03
 splice04 splice04
 splice05 splice05
testcases/kernel/syscalls/splice/splice02.c +135 -11

175 lines not on this page · raw message

Signature · 1 line
2.31.1
author
#1 lore raw

PATCH v6 2/2 commands: Add shell pipe test

This adds basic shell pipe testing, which was removed from splice02 in 85cebe238 ("splice02: Generate input in C").

---
Same as v4 and v5

 runtest/commands                         |  1 +
 runtest/smoketest                        |  1 +
 testcases/commands/shell/Makefile        | 10 ++++++++++
 testcases/commands/shell/shell_pipe01.sh | 17 +++++++++++++++++
 4 files changed, 29 insertions(+)
 create mode 100644 testcases/commands/shell/Makefile
 create mode 100755 testcases/commands/shell/shell_pipe01.sh
runtest/commands +1 -0
index 058266b54..8cfad0449 100644
@@ -41,3 +41,4 @@ gdb01_sh gdb01.sh
 unshare01_sh unshare01.sh
 sysctl01_sh sysctl01.sh
 sysctl02_sh sysctl02.sh
+shell_test01 echo "SUCCESS" | shell_pipe01.sh
runtest/smoketest +1 -0
index 2224d8f74..7f395936e 100644
@@ -13,3 +13,4 @@ utime01A symlink01 -T utime01
 rename01A symlink01 -T rename01
 splice02 splice02 -s 20
 route4-change-dst route-change-dst.sh
+shell_test01 echo "SUCCESS" | shell_pipe01.sh
testcases/commands/shell/Makefile new file +10 -0
new file mode 100644
index 000000000..c696ec35a
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) Linux Test Project, 2021
+
+top_srcdir		?= ../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_TARGETS		:= *.sh
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/commands/shell/shell_pipe01.sh new file +17 -0
new file mode 100755
index 000000000..3c8ef49fb
@@ -0,0 +1,17 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2021 Petr Vorel <[email protected]>
+
+TST_TESTFUNC=do_test
+
+. tst_test.sh
+
+do_test()
+{
+	tst_res TINFO "expecting SUCCESS string passed from stdin"
+
+	read line
+	EXPECT_PASS [ "$line" = "SUCCESS" ]
+}
+
+tst_run
Signature · 1 line
2.31.1