Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Christian Dietrich
clang-hash
Commits
41e3e080
Commit
41e3e080
authored
Mar 17, 2016
by
Christian Dietrich
Browse files
run-tests: add assert-ast and assert-obj flags
parent
a30e8696
Changes
8
Hide whitespace changes
Inline
Side-by-side
test/bb_goto_dotdot.c
View file @
41e3e080
...
...
@@ -17,7 +17,7 @@ extern int docd(const char *, int);
#include
<unistd.h>
static
int
int
cdcmd
(
int
argc
,
char
**
argv
)
{
const
char
*
dest
;
...
...
@@ -41,7 +41,7 @@ cdcmd(int argc, char **argv)
goto
step7
;
if
(
*
dest
==
'.'
)
{
c
=
dest
[
1
];
dotdot:
{{
A
}}
dotdot
:
switch
(
c
)
{
case
'\0'
:
case
'/'
:
...
...
@@ -58,7 +58,9 @@ cdcmd(int argc, char **argv)
if
(
!
path
)
{
step6:
step7:
p
=
dest
;
{{
B
}}
dotdot
:
p
=
dest
;
goto
docd
;
}
do
{
...
...
@@ -80,7 +82,7 @@ cdcmd(int argc, char **argv)
out1fmt
(
"%s
\n
"
,
curdir
);
return
0
;
}
{{
A
}}
/*
* check-name: complex stuff once failed
* check-name: Forward and backward gotos
* assert-obj: A != B
*/
test/bb_goto_dotdot_6.c
View file @
41e3e080
void
cdcmd
(
void
)
{
const
char
*
dest
;
const
char
*
dest
;
{{
A
}}
const
char
*
const
dest
;
{{
B
}}
char
c
;
c
=
dest
[
2
];
}
{{
A
}}
/*
* check-name: qualifiers in subtype
* obj-not-diff: maybe
* assert-ast: A != B
*/
test/expressions/arrayaccess.c
View file @
41e3e080
...
...
@@ -6,5 +6,5 @@ int f(){
}
/*
* check-name: Initlist array access
*
B
!=
A
*
assert-ast: A
!=
B
*/
test/expressions/assign_base.c
View file @
41e3e080
...
...
@@ -4,5 +4,5 @@ int a = 0x4711; {{C}}
/*
* check-name: oktal,...
* B != A, B != C, A != C
*
assert-obj:
B != A, B != C, A != C
*/
test/expressions/assign_unnot.c
View file @
41e3e080
...
...
@@ -7,5 +7,5 @@ void f(){
}
/*
* check-name: NOT, L_NOT
* B != A, B != C, C != A
*
assert-obj:
B != A, B != C, C != A
*/
test/preprocessor/include.c
View file @
41e3e080
...
...
@@ -9,5 +9,6 @@ int foo() {
/*
* check-name: Include with function extern
* obj-not-diff: void parameter != no parameter
* B == A
* assert-ast: A != B
* assert-obj: A == B
*/
test/run-tests
View file @
41e3e080
...
...
@@ -145,6 +145,34 @@ def get_variants(test_case):
variants
[
variant
]
=
"
\n
"
.
join
(
text
)
return
variants
def
check_asserts
(
asserts
,
results
,
idx
):
asserts
=
[
x
.
strip
()
for
x
in
asserts
.
split
(
","
)]
failed
=
False
output
=
""
for
A
in
asserts
:
if
"=="
in
A
:
(
LHS
,
RHS
)
=
A
.
split
(
"=="
)
LHS
=
results
[
LHS
.
strip
()][
idx
]
RHS
=
results
[
RHS
.
strip
()][
idx
]
if
LHS
!=
RHS
:
output
+=
COLOR
.
format
(
" ASSERT"
,
"red"
,
True
)
+
" failed: "
+
A
+
"
\n
"
failed
=
True
elif
LOGLEVEL
>=
LOGLEVEL_DEBUG
:
output
+=
COLOR
.
format
(
" ASSERT"
,
"green"
)
+
" holds: %s
\n
"
%
A
elif
"!="
in
A
:
(
LHS
,
RHS
)
=
A
.
split
(
"!="
)
LHS
=
results
[
LHS
.
strip
()][
idx
]
RHS
=
results
[
RHS
.
strip
()][
idx
]
if
LHS
==
RHS
:
output
+=
COLOR
.
format
(
" ASSERT"
,
"red"
,
True
)
+
" failed: "
+
A
+
"
\n
"
failed
=
True
elif
LOGLEVEL
>=
LOGLEVEL_DEBUG
:
output
+=
COLOR
.
format
(
" ASSERT"
,
"green"
)
+
" holds: %s
\n
"
%
A
else
:
assert
False
,
"Invalid assert: "
+
A
return
failed
,
output
def
run_testcase_cleaner
(
basename
):
cruftfiles
=
list
()
...
...
@@ -286,6 +314,18 @@ def run_testcase_helper(test_case, check_name, future):
failed
=
True
assert_ast
=
get_tag
(
test_case
,
"assert-ast"
)
assert_obj
=
get_tag
(
test_case
,
"assert-obj"
)
if
assert_obj
:
(
F
,
out
)
=
check_asserts
(
assert_obj
,
results
,
0
)
failed
=
failed
or
F
output
+=
out
if
assert_ast
:
(
F
,
out
)
=
check_asserts
(
assert_ast
,
results
,
1
)
failed
=
failed
or
F
output
+=
out
if
failed
:
output
+=
" Failed
\n
"
...
...
@@ -380,6 +420,9 @@ if __name__ == '__main__':
print
"unkown option"
assert
False
if
len
(
args
)
==
0
:
args
=
[
"."
]
ret
=
run_test_suite
(
get_testcases
(
args
))
if
ret
:
...
...
test/toolchain/internal-linkage.c
View file @
41e3e080
...
...
@@ -13,5 +13,5 @@ void foo() {
* check-name: internal linkage name changes
* compile-command: /usr/bin/gcc
* compile-flags: -fdata-sections -Wall
*
B
==
A
*
assert-ast: A
==
B
*/
Write
Preview
Supports
Markdown
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