File tree Expand file tree Collapse file tree 1 file changed +12
-32
lines changed
testcases/kernel/syscalls/dup Expand file tree Collapse file tree 1 file changed +12
-32
lines changed Original file line number Diff line number Diff line change 11// SPDX-License-Identifier: GPL-2.0-only
22/*
33 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
4- *
54 * 06/1994 AUTHOR: Richard Logan CO-PILOT: William Roske
5+ * Copyright (c) 2023 SUSE LLC
66 */
77
88/*\
9- * [DESCRIPTION ]
9+ * [Description ]
1010 *
1111 * Basic test for dup(2) of a system pipe descriptor.
1212 */
1717
1818#include "tst_test.h"
1919
20- int fd [2 ];
20+ static int fd [2 ];
2121
2222static void run (void )
2323{
24- TEST (dup (fd [0 ]));
25-
26- if (TST_RET == -1 )
27- tst_res (TFAIL | TTERRNO ,
28- "dup of read side of pipe failed" );
29- else {
30- tst_res (TPASS ,
31- "dup(%d) read side of syspipe returned %ld" ,
32- fd [0 ], TST_RET );
33-
34- SAFE_CLOSE (TST_RET );
35- }
36-
37- TEST (dup (fd [1 ]));
38-
39- if (TST_RET == -1 ) {
40- tst_res (TFAIL | TTERRNO ,
41- "dup of write side of pipe failed" );
42- } else {
43- tst_res (TPASS ,
44- "dup(%d) write side of syspipe returned %ld" ,
45- fd [1 ], TST_RET );
46-
47- SAFE_CLOSE (TST_RET );
48- }
24+ TST_EXP_FD (dup (fd [0 ]), "dup(%d) read end of the pipe" , fd [0 ]);
25+ SAFE_CLOSE (TST_RET );
26+
27+ TST_EXP_FD (dup (fd [1 ]), "dup(%d) write end of the pipe" , fd [1 ]);
28+ SAFE_CLOSE (TST_RET );
4929}
5030
51- void setup (void )
31+ static void setup (void )
5232{
5333 fd [0 ] = -1 ;
5434
5535 SAFE_PIPE (fd );
5636}
5737
5838static struct tst_test test = {
59- .test_all = run ,
60- .setup = setup ,
61- .needs_tmpdir = 1 ,
39+ .test_all = run ,
40+ .setup = setup ,
41+ .needs_tmpdir = 1 ,
6242};
You can’t perform that action at this time.
0 commit comments