From f819d6f7cb99737851dcaaa51f11190138fd48d5 Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Sun, 19 Nov 2023 23:53:28 +0100 Subject: compiler/testdata: add missing error cases This commit adds error cases that weren't covered before. They were identified by looking at the coverage numbers for pkg/compiler. Signed-off-by: Paul Chaignon --- pkg/compiler/testdata/errors.txt | 6 ++++++ pkg/compiler/testdata/errors2.txt | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'pkg/compiler') diff --git a/pkg/compiler/testdata/errors.txt b/pkg/compiler/testdata/errors.txt index 84cfad221..64a54877b 100644 --- a/pkg/compiler/testdata/errors.txt +++ b/pkg/compiler/testdata/errors.txt @@ -139,6 +139,7 @@ foo$70() ("foo") ### unexpected string "foo", expect attribute foo$71() (42) ### unexpected int 42, expect attribute foo$72() (disabled, disabled) ### duplicate syscall foo$72 attribute disabled foo$73(a int32[int_flags, 2]) ### align argument of int32 is not supported unless first argument is a range +foo$74() (int8:1) ### unexpected ':' opt { ### struct uses reserved name opt f1 int32 @@ -167,6 +168,7 @@ s3 { f7 int32:33 ### bitfield of size 33 is too large for base type of size 32 f8 const[0, int32:C1] ### literal const bitfield sizes are not supported f9 const[0] ### wrong number of arguments for type const, expect value, base type + f10 int8:1:1 ### unexpected ':' } [packed, align[4]] s5 { @@ -201,6 +203,10 @@ s13 { f1 int8 } [size[0[0]]] ### size attribute has colon or args +s14 { + f1 int8 +} [size[1, 2]] ### size attribute is expected to have 1 argument + u3 [ f1 int8 f2 int32 diff --git a/pkg/compiler/testdata/errors2.txt b/pkg/compiler/testdata/errors2.txt index 1120f55ad..13e69ef8a 100644 --- a/pkg/compiler/testdata/errors2.txt +++ b/pkg/compiler/testdata/errors2.txt @@ -157,15 +157,24 @@ slen1 { f7 len[syscall:b, int32] ### len target b does not exist f8 offsetof[parent, int32] ### offsetof must refer to fields f9 offsetof[slen1, int32] ### offsetof must refer to fields + f10 len[f0:syscall:b, int32] ### syscall can't be in the middle of path expressions + f11 len[slen3:a, int32] ### len path slen3 does not refer to a struct slen2 ptr[in, array[slen2]] slen21 slen2 + slen3 slen3 slen22 array[slen2] } slen2 { - f int32 + f int32 + f1 slen3 } +slen3 [ + a int32 + b int32 +] + # Resource ctor tests. resource r100[int32] ### resource r100 can't be created (never mentioned as a syscall return value or output argument/field) -- cgit mrf-deployment