Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Felix Münchhalfen
wine
Commits
b02f0940
Commit
b02f0940
authored
22 years ago
by
Jakob Eriksson
Committed by
Alexandre Julliard
22 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Tests for _lcreat,_llseek and _llopen added.
parent
87ecfab4
No related branches found
Branches containing commit
Tags
wine-950403
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/kernel/tests/file.c
+150
-9
150 additions, 9 deletions
dlls/kernel/tests/file.c
with
150 additions
and
9 deletions
dlls/kernel/tests/file.c
+
150
−
9
View file @
b02f0940
...
...
@@ -48,14 +48,15 @@ static void test__hread( void )
UINT
i
;
filehandle
=
_lcreat
(
filename
,
0
);
ok
(
HFILE_ERROR
!=
filehandle
,
"_lcreat complains."
);
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't create file. Wrong permissions on directory?"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains."
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains."
);
filehandle
=
_lopen
(
filename
,
OF_READ
);
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't open file again?"
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
2
*
strlen
(
sillytext
)
);
...
...
@@ -89,8 +90,7 @@ static void test__hwrite( void )
char
checksum
[
1
];
filehandle
=
_lcreat
(
filename
,
0
);
ok
(
HFILE_ERROR
!=
filehandle
,
"_lcreat complains."
);
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't create file. Wrong permissions on directory?"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
""
,
0
),
"_hwrite complains."
);
...
...
@@ -149,8 +149,7 @@ static void test__hwrite( void )
while
(
i
<
bytes_written
-
1
);
ok
(
checksum
[
0
]
==
contents
[
i
],
"stored checksum differ from computed checksum."
);
return
;
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains."
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile complains."
);
...
...
@@ -161,8 +160,7 @@ static void test__lclose( void )
HFILE
filehandle
;
filehandle
=
_lcreat
(
filename
,
0
);
ok
(
HFILE_ERROR
!=
filehandle
,
"_lcreat complains."
);
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't create file. Wrong permissions on directory?"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains."
);
...
...
@@ -172,13 +170,156 @@ static void test__lclose( void )
ok
(
HFILE_ERROR
==
_lclose
(
filehandle
),
"_lclose should whine about this."
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile complains."
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFile
A
complains."
);
}
static
void
test__lcreat
(
void
)
{
HFILE
filehandle
;
char
buffer
[
10000
];
WIN32_FIND_DATAA
search_results
;
filehandle
=
_lcreat
(
filename
,
0
);
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't create file. Wrong permissions on directory?"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains."
);
ok
(
0
==
_llseek
(
filehandle
,
0
,
FILE_BEGIN
),
"_llseek complains."
);
ok
(
_hread
(
filehandle
,
buffer
,
strlen
(
sillytext
)
)
==
strlen
(
sillytext
),
"erratic _hread return value."
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains."
);
ok
(
INVALID_HANDLE_VALUE
!=
FindFirstFileA
(
filename
,
&
search_results
),
"should be able to find file"
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFileA complains."
);
filehandle
=
_lcreat
(
filename
,
1
);
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't create file!?"
);
#if 0 /* FIXME: this fails on NT too */
ok( HFILE_ERROR == _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite shouldn't succeed writing." );
#endif
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains."
);
ok
(
INVALID_HANDLE_VALUE
!=
FindFirstFileA
(
filename
,
&
search_results
),
"should be able to find file"
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFileA complains."
);
filehandle
=
_lcreat
(
filename
,
2
);
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't create file. Wrong permissions on directory?"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains."
);
ok
(
0
==
_llseek
(
filehandle
,
0
,
FILE_BEGIN
),
"_llseek complains."
);
ok
(
_hread
(
filehandle
,
buffer
,
strlen
(
sillytext
)
)
==
strlen
(
sillytext
),
"erratic _hread return value."
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains."
);
todo_wine
{
ok
(
INVALID_HANDLE_VALUE
==
FindFirstFileA
(
filename
,
&
search_results
),
"should NOT be able to find file"
);
}
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFileA complains."
);
filehandle
=
_lcreat
(
filename
,
4
);
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't create file. Wrong permissions on directory?"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains."
);
ok
(
0
==
_llseek
(
filehandle
,
0
,
FILE_BEGIN
),
"_llseek complains."
);
ok
(
_hread
(
filehandle
,
buffer
,
strlen
(
sillytext
)
)
==
strlen
(
sillytext
),
"erratic _hread return value."
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains."
);
todo_wine
{
ok
(
INVALID_HANDLE_VALUE
==
FindFirstFileA
(
filename
,
&
search_results
),
"should NOT be able to find file"
);
}
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFileA complains."
);
}
void
test__llseek
(
void
)
{
INT
i
;
HFILE
filehandle
;
char
buffer
[
1
];
long
bytes_read
;
filehandle
=
_lcreat
(
filename
,
0
);
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't create file. Wrong permissions on directory?"
);
for
(
i
=
0
;
i
<
400
;
i
++
)
{
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains."
);
}
ok
(
HFILE_ERROR
!=
_llseek
(
filehandle
,
400
*
strlen
(
sillytext
),
FILE_CURRENT
),
"should be able to seek"
);
ok
(
HFILE_ERROR
!=
_llseek
(
filehandle
,
27
+
35
*
strlen
(
sillytext
),
FILE_BEGIN
),
"should be able to seek"
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
1
);
ok
(
1
==
bytes_read
,
"file read size error."
);
ok
(
buffer
[
0
]
==
sillytext
[
27
],
"_llseek error. It got lost seeking..."
);
ok
(
HFILE_ERROR
!=
_llseek
(
filehandle
,
-
400
*
strlen
(
sillytext
),
FILE_END
),
"should be able to seek"
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
1
);
ok
(
1
==
bytes_read
,
"file read size error."
);
ok
(
buffer
[
0
]
==
sillytext
[
0
],
"_llseek error. It got lost seeking..."
);
#if 0 /* FIXME: this fails on NT too */
ok( HFILE_ERROR == _llseek( filehandle, 1000000, FILE_END ), "should get HFILE_ERROR for trying to seek past end of file" );
#endif
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains."
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFileA complains."
);
}
void
test__llopen
(
void
)
{
HFILE
filehandle
;
UINT
bytes_read
;
char
buffer
[
10000
];
filehandle
=
_lcreat
(
filename
,
0
);
ok
(
HFILE_ERROR
!=
filehandle
,
"couldn't create file. Wrong permissions on directory?"
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite complains."
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains."
);
filehandle
=
_lopen
(
filename
,
OF_READ
);
ok
(
HFILE_ERROR
==
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite shouldn't be able to write!"
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
strlen
(
sillytext
)
);
ok
(
strlen
(
sillytext
)
==
bytes_read
,
"file read size error."
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains."
);
filehandle
=
_lopen
(
filename
,
OF_READWRITE
);
bytes_read
=
_hread
(
filehandle
,
buffer
,
2
*
strlen
(
sillytext
)
);
ok
(
strlen
(
sillytext
)
==
bytes_read
,
"file read size error."
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite should write just fine."
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains."
);
filehandle
=
_lopen
(
filename
,
OF_WRITE
);
ok
(
HFILE_ERROR
==
_hread
(
filehandle
,
buffer
,
1
),
"you should only be able to write this file..."
);
ok
(
HFILE_ERROR
!=
_hwrite
(
filehandle
,
sillytext
,
strlen
(
sillytext
)
),
"_hwrite should write just fine."
);
ok
(
HFILE_ERROR
!=
_lclose
(
filehandle
),
"_lclose complains."
);
ok
(
DeleteFileA
(
filename
)
!=
0
,
"DeleteFileA complains."
);
/* TODO - add tests for the SHARE modes - use two processes to pull this off */
}
START_TEST
(
file
)
{
test__hread
(
);
test__hwrite
(
);
test__lclose
(
);
test__lcreat
(
);
test__llseek
(
);
test__llopen
(
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment