Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
417d25eb
Commit
417d25eb
authored
Apr 04, 2024
by
Eric Pouech
Committed by
Alexandre Julliard
Apr 11, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt/tests: Add tests for check buffering state of standard streams.
Signed-off-by:
Eric Pouech
<
epouech@codeweavers.com
>
parent
72987ffc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
0 deletions
+59
-0
file.c
dlls/msvcrt/tests/file.c
+59
-0
No files found.
dlls/msvcrt/tests/file.c
View file @
417d25eb
...
...
@@ -3059,6 +3059,64 @@ static void test_ioinfo_flags(void)
free
(
tempf
);
}
static
void
test_std_stream_buffering
(
void
)
{
int
dup_fd
,
ret
,
pos
;
FILE
*
file
;
char
ch
;
dup_fd
=
_dup
(
STDOUT_FILENO
);
ok
(
dup_fd
!=
-
1
,
"_dup failed
\n
"
);
file
=
freopen
(
"std_stream_test.tmp"
,
"w"
,
stdout
);
ok
(
file
!=
NULL
,
"freopen failed
\n
"
);
ret
=
fprintf
(
stdout
,
"test"
);
pos
=
_telli64
(
STDOUT_FILENO
);
fflush
(
stdout
);
_dup2
(
dup_fd
,
STDOUT_FILENO
);
close
(
dup_fd
);
setvbuf
(
stdout
,
NULL
,
_IONBF
,
0
);
ok
(
ret
==
4
,
"fprintf(stdout) returned %d
\n
"
,
ret
);
ok
(
!
pos
,
"expected stdout to be buffered
\n
"
);
dup_fd
=
_dup
(
STDERR_FILENO
);
ok
(
dup_fd
!=
-
1
,
"_dup failed
\n
"
);
file
=
freopen
(
"std_stream_test.tmp"
,
"w"
,
stderr
);
ok
(
file
!=
NULL
,
"freopen failed
\n
"
);
ret
=
fprintf
(
stderr
,
"test"
);
ok
(
ret
==
4
,
"fprintf(stderr) returned %d
\n
"
,
ret
);
pos
=
_telli64
(
STDERR_FILENO
);
ok
(
!
pos
,
"expected stderr to be buffered
\n
"
);
fflush
(
stderr
);
_dup2
(
dup_fd
,
STDERR_FILENO
);
close
(
dup_fd
);
dup_fd
=
_dup
(
STDIN_FILENO
);
ok
(
dup_fd
!=
-
1
,
"_dup failed
\n
"
);
file
=
freopen
(
"std_stream_test.tmp"
,
"r"
,
stdin
);
ok
(
file
!=
NULL
,
"freopen failed
\n
"
);
ch
=
0
;
ret
=
fscanf
(
stdin
,
"%c"
,
&
ch
);
ok
(
ret
==
1
,
"fscanf returned %d
\n
"
,
ret
);
ok
(
ch
==
't'
,
"ch = 0x%x
\n
"
,
(
unsigned
char
)
ch
);
pos
=
_telli64
(
STDIN_FILENO
);
ok
(
pos
==
4
,
"pos = %d
\n
"
,
pos
);
fflush
(
stdin
);
_dup2
(
dup_fd
,
STDIN_FILENO
);
close
(
dup_fd
);
ok
(
DeleteFileA
(
"std_stream_test.tmp"
),
"DeleteFile failed
\n
"
);
}
START_TEST
(
file
)
{
int
arg_c
;
...
...
@@ -3135,6 +3193,7 @@ START_TEST(file)
test_fopen_hints
();
test_open_hints
();
test_ioinfo_flags
();
test_std_stream_buffering
();
/* Wait for the (_P_NOWAIT) spawned processes to finish to make sure the report
* file contains lines in the correct order
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment