diff options
| author | Jiao, Joey <quic_jiangenj@quicinc.com> | 2024-11-06 13:41:21 +0800 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2024-11-13 11:16:59 +0000 |
| commit | 4dfba277487a7023ab9f5783302da4a9b5e9bef8 (patch) | |
| tree | 72c5a0b86f7e38922230b4421ebe50c5654e5cdc /pkg/ast/testdata | |
| parent | bb3f84250514d5990939e57b5d1ff8badc566033 (diff) | |
all: support || operator in syzlang if condition
ex. f3 field has logic or operator in if condition:
conditional_struct {
mask int32
f1 field1 (if[value[mask] & FIELD_FLAG1])
f2 int64 (if[value[mask] & FIELD_FLAG2])
f3 int64 (if[value[mask] == FIELD_FLAG1 || value[mask] == FIELD_FLAG2])
} [packed]
Diffstat (limited to 'pkg/ast/testdata')
| -rw-r--r-- | pkg/ast/testdata/all.txt | 3 | ||||
| -rw-r--r-- | pkg/ast/testdata/errors.txt | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/pkg/ast/testdata/all.txt b/pkg/ast/testdata/all.txt index a274b3eff..d5587c027 100644 --- a/pkg/ast/testdata/all.txt +++ b/pkg/ast/testdata/all.txt @@ -14,6 +14,7 @@ expressions { f1 int8 (if[X & Y == Z]) f2 int8 (if[X & Y & Z == value[X] & A]) f3 int8 (if[X & (A == B) & Z != C]) + f5 int8 (if[value[X] == A || value[X] == B]) } intflags = 1, 2, 3, 4 @@ -29,4 +30,6 @@ condFields { f2 int16 (out, if[val[mask] & SOME_CONST == OTHER_CONST]) f3 int16 (out, if[val[mask] & SOME_CONST & OTHER_CONST == val[mask] & CONST_X]) f4 int16 (out, if[val[flags] & SOME_CONST]) + f5 int16 (out, if[val[flags] == SOME_CONST || val[flags] == OTHER_CONST]) + f6 int16 (out, if[val[flags] == SOME_CONST || val[flags] & OTHER_CONST]) } diff --git a/pkg/ast/testdata/errors.txt b/pkg/ast/testdata/errors.txt index b3d9e7f52..a8a4aa197 100644 --- a/pkg/ast/testdata/errors.txt +++ b/pkg/ast/testdata/errors.txt @@ -75,6 +75,14 @@ sCondFieldsError2 { f5 int16 (out, if[val[mask] & == val[mask]]) ### unexpected ==, expecting int, identifier, string } ### unexpected '}', expecting comment, define, include, resource, identifier +sCondFieldsError3 { + f6 int16 (out, if[val[mask] == SOME_CONST] || [val[mask]]) ### unexpected '[', expecting int, identifier, string +} ### unexpected '}', expecting comment, define, include, resource, identifier + +sCondFieldsError4 { + f7 int16 (out, if[val[mask] == SOME_CONST || val[mask] ==]) ### unexpected ']', expecting int, identifier, string +} ### unexpected '}', expecting comment, define, include, resource, identifier + type mybool8 int8 type net_port proc[1, 2, int16be] type mybool16 ### unexpected '\n', expecting '[', identifier |
