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 1
1
// SPDX-License-Identifier: GPL-2.0-only
2
2
/*
3
3
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
4
- *
5
4
* 06/1994 AUTHOR: Richard Logan CO-PILOT: William Roske
5
+ * Copyright (c) 2023 SUSE LLC
6
6
*/
7
7
8
8
/*\
9
- * [DESCRIPTION ]
9
+ * [Description ]
10
10
*
11
11
* Basic test for dup(2) of a system pipe descriptor.
12
12
*/
17
17
18
18
#include "tst_test.h"
19
19
20
- int fd [2 ];
20
+ static int fd [2 ];
21
21
22
22
static void run (void )
23
23
{
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 );
49
29
}
50
30
51
- void setup (void )
31
+ static void setup (void )
52
32
{
53
33
fd [0 ] = -1 ;
54
34
55
35
SAFE_PIPE (fd );
56
36
}
57
37
58
38
static 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 ,
62
42
};
You can’t perform that action at this time.
0 commit comments