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
d1f8dd15
Commit
d1f8dd15
authored
Aug 26, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Allow alternate results in the env test to make it pass on Vista.
parent
51764497
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
22 deletions
+21
-22
env.c
dlls/ntdll/tests/env.c
+21
-22
No files found.
dlls/ntdll/tests/env.c
View file @
d1f8dd15
...
...
@@ -57,6 +57,7 @@ static void testQuery(void)
int
len
;
NTSTATUS
status
;
const
char
*
val
;
NTSTATUS
alt
;
};
static
const
struct
test
tests
[]
=
...
...
@@ -67,12 +68,13 @@ static void testQuery(void)
{
"foo "
,
256
,
STATUS_VARIABLE_NOT_FOUND
,
NULL
},
{
"foo"
,
1
,
STATUS_BUFFER_TOO_SMALL
,
"toto"
},
{
"foo"
,
3
,
STATUS_BUFFER_TOO_SMALL
,
"toto"
},
{
"foo"
,
4
,
STATUS_SUCCESS
,
"toto"
},
{
"foo"
,
4
,
STATUS_SUCCESS
,
"toto"
,
STATUS_BUFFER_TOO_SMALL
},
{
"foo"
,
5
,
STATUS_SUCCESS
,
"toto"
},
{
"fooo"
,
256
,
STATUS_SUCCESS
,
"tutu"
},
{
"f"
,
256
,
STATUS_VARIABLE_NOT_FOUND
,
NULL
},
{
"g"
,
256
,
STATUS_SUCCESS
,
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
{
"sr=an"
,
256
,
STATUS_
VARIABLE_NOT_FOUND
,
NULL
},
{
"sr=an"
,
256
,
STATUS_
SUCCESS
,
"ouo"
,
STATUS_VARIABLE_NOT_FOUND
},
{
"sr"
,
256
,
STATUS_SUCCESS
,
"an=ouo"
},
{
"=oOH"
,
256
,
STATUS_SUCCESS
,
"III"
},
{
""
,
256
,
STATUS_VARIABLE_NOT_FOUND
,
NULL
},
...
...
@@ -99,7 +101,8 @@ static void testQuery(void)
pRtlMultiByteToUnicodeN
(
bn
,
sizeof
(
bn
),
NULL
,
test
->
var
,
strlen
(
test
->
var
)
+
1
);
nts
=
pRtlQueryEnvironmentVariable_U
(
small_env
,
&
name
,
&
value
);
ok
(
nts
==
test
->
status
,
"[%d]: Wrong status for '%s', expecting %x got %x
\n
"
,
ok
(
nts
==
test
->
status
||
(
test
->
alt
&&
nts
==
test
->
alt
),
"[%d]: Wrong status for '%s', expecting %x got %x
\n
"
,
test
-
tests
,
test
->
var
,
test
->
status
,
nts
);
if
(
nts
==
test
->
status
)
switch
(
nts
)
{
...
...
@@ -120,7 +123,7 @@ static void testQuery(void)
}
}
static
void
testSetHelper
(
LPWSTR
*
env
,
const
char
*
var
,
const
char
*
val
,
NTSTATUS
ret
)
static
void
testSetHelper
(
LPWSTR
*
env
,
const
char
*
var
,
const
char
*
val
,
NTSTATUS
ret
,
NTSTATUS
alt
)
{
WCHAR
bvar
[
256
],
bval1
[
256
],
bval2
[
256
];
UNICODE_STRING
uvar
;
...
...
@@ -139,7 +142,7 @@ static void testSetHelper(LPWSTR* env, const char* var, const char* val, NTSTATU
pRtlMultiByteToUnicodeN
(
bval1
,
sizeof
(
bval1
),
NULL
,
val
,
strlen
(
val
)
+
1
);
}
nts
=
pRtlSetEnvironmentVariable
(
env
,
&
uvar
,
val
?
&
uval
:
NULL
);
ok
(
nts
==
ret
,
"Setting var %s=%s (%x/%x)
\n
"
,
var
,
val
,
nts
,
ret
);
ok
(
nts
==
ret
||
(
alt
&&
nts
==
alt
)
,
"Setting var %s=%s (%x/%x)
\n
"
,
var
,
val
,
nts
,
ret
);
if
(
nts
==
STATUS_SUCCESS
)
{
uval
.
Length
=
0
;
...
...
@@ -168,31 +171,30 @@ static void testSet(void)
int
i
;
ok
(
pRtlCreateEnvironment
(
FALSE
,
&
env
)
==
STATUS_SUCCESS
,
"Creating environment
\n
"
);
memmove
(
env
,
small_env
,
sizeof
(
small_env
));
testSetHelper
(
&
env
,
"cat"
,
"dog"
,
STATUS_SUCCESS
);
testSetHelper
(
&
env
,
"cat"
,
"horse"
,
STATUS_SUCCESS
);
testSetHelper
(
&
env
,
"cat"
,
"zz"
,
STATUS_SUCCESS
);
testSetHelper
(
&
env
,
"cat"
,
NULL
,
STATUS_SUCCESS
);
testSetHelper
(
&
env
,
"cat"
,
NULL
,
STATUS_VARIABLE_NOT_FOUND
);
testSetHelper
(
&
env
,
"foo"
,
"meouw"
,
STATUS_SUCCESS
);
testSetHelper
(
&
env
,
"me=too"
,
"also"
,
STATUS_INVALID_PARAMETER
);
testSetHelper
(
&
env
,
"me"
,
"too=also"
,
STATUS_SUCCESS
);
testSetHelper
(
&
env
,
"=too"
,
"also"
,
STATUS_SUCCESS
);
testSetHelper
(
&
env
,
"="
,
"also"
,
STATUS_SUCCESS
);
testSetHelper
(
&
env
,
"cat"
,
"dog"
,
STATUS_SUCCESS
,
0
);
testSetHelper
(
&
env
,
"cat"
,
"horse"
,
STATUS_SUCCESS
,
0
);
testSetHelper
(
&
env
,
"cat"
,
"zz"
,
STATUS_SUCCESS
,
0
);
testSetHelper
(
&
env
,
"cat"
,
NULL
,
STATUS_SUCCESS
,
0
);
testSetHelper
(
&
env
,
"cat"
,
NULL
,
STATUS_
SUCCESS
,
STATUS_
VARIABLE_NOT_FOUND
);
testSetHelper
(
&
env
,
"foo"
,
"meouw"
,
STATUS_SUCCESS
,
0
);
testSetHelper
(
&
env
,
"me=too"
,
"also"
,
STATUS_INVALID_PARAMETER
,
0
);
testSetHelper
(
&
env
,
"me"
,
"too=also"
,
STATUS_SUCCESS
,
0
);
testSetHelper
(
&
env
,
"=too"
,
"also"
,
STATUS_SUCCESS
,
0
);
testSetHelper
(
&
env
,
"="
,
"also"
,
STATUS_SUCCESS
,
0
);
for
(
i
=
0
;
i
<
128
;
i
++
)
{
sprintf
(
tmp
,
"zork%03d"
,
i
);
testSetHelper
(
&
env
,
tmp
,
"is alive"
,
STATUS_SUCCESS
);
testSetHelper
(
&
env
,
tmp
,
"is alive"
,
STATUS_SUCCESS
,
0
);
}
for
(
i
=
0
;
i
<
128
;
i
++
)
{
sprintf
(
tmp
,
"zork%03d"
,
i
);
testSetHelper
(
&
env
,
tmp
,
NULL
,
STATUS_SUCCESS
);
testSetHelper
(
&
env
,
tmp
,
NULL
,
STATUS_SUCCESS
,
0
);
}
testSetHelper
(
&
env
,
"fOo"
,
NULL
,
STATUS_SUCCESS
);
testSetHelper
(
&
env
,
"fOo"
,
NULL
,
STATUS_SUCCESS
,
0
);
ok
(
pRtlDestroyEnvironment
(
env
)
==
STATUS_SUCCESS
,
"Destroying environment
\n
"
);
}
...
...
@@ -263,9 +265,6 @@ static void testExpand(void)
ok
(
nts
==
STATUS_BUFFER_TOO_SMALL
,
"Call failed (%u)
\n
"
,
nts
);
ok
(
ul
==
strlen
(
test
->
dst
)
*
sizeof
(
WCHAR
)
+
sizeof
(
WCHAR
),
"Wrong returned length for %s (with buffer too small): %u
\n
"
,
test
->
src
,
ul
);
ok
(
memcmp
(
dst
,
rst
,
8
*
sizeof
(
WCHAR
))
==
0
,
"Wrong result for %s (with buffer too small): expecting %s
\n
"
,
test
->
src
,
test
->
dst
);
ok
(
dst
[
8
]
==
'-'
,
"Writing too far in buffer (got %c/%d)
\n
"
,
dst
[
8
],
dst
[
8
]);
}
...
...
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