aboutsummaryrefslogtreecommitdiffstats
path: root/prog/encoding_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-12-10 15:49:04 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-12-10 16:37:02 +0100
commit28bd3e371b1f31cb243f0df56b9c7720971a89db (patch)
treeac2ff223b4b855f0bcb554bc65dcff07a2f4e49c /prog/encoding_test.go
parentc7ba317e9bfa7672d851df1217c2c3ea045c55f1 (diff)
prog: support AUTO args in programs
AUTO arguments can be used for: - consts - lens - pointers For const's and len's AUTO is replaced with the natural value, addresses for AUTO pointers are allocated linearly. This greatly simplifies writing test programs by hand as most of the time we want these natural values. Update tests to use AUTO.
Diffstat (limited to 'prog/encoding_test.go')
-rw-r--r--prog/encoding_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/prog/encoding_test.go b/prog/encoding_test.go
index acaf642d5..ac670a8ab 100644
--- a/prog/encoding_test.go
+++ b/prog/encoding_test.go
@@ -245,6 +245,14 @@ func TestDeserialize(t *testing.T) {
input: `test$excessive_fields1(0xfffffffffffffffc)`,
output: `test$excessive_fields1(0xffffffffffffffff)`,
},
+ {
+ input: `test$auto0(AUTO, &AUTO={AUTO, AUTO, 0x1}, AUTO, 0x0)`,
+ output: `test$auto0(0x42, &(0x7f0000000040)={0xc, 0x43, 0x1}, 0xc, 0x0)`,
+ },
+ {
+ input: `test$auto0(AUTO, &AUTO={AUTO, AUTO, AUTO}, AUTO, 0x0)`,
+ err: regexp.MustCompile(`wrong type \*prog\.IntType for AUTO`),
+ },
}
buf := make([]byte, ExecBufferSize)
for _, test := range tests {