From 28bd3e371b1f31cb243f0df56b9c7720971a89db Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 10 Dec 2018 15:49:04 +0100 Subject: 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. --- sys/test/gen/64.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'sys/test/gen') diff --git a/sys/test/gen/64.go b/sys/test/gen/64.go index 1abe96317..d3c24241d 100644 --- a/sys/test/gen/64.go +++ b/sys/test/gen/64.go @@ -65,6 +65,11 @@ var structDescs_64 = []*KeyedStruct{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "i8", TypeSize: 1}}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "i32", TypeSize: 4}}}, }}}, + {Key: StructKey{Name: "auto_struct0"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "auto_struct0", TypeSize: 12}, Fields: []Type{ + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "f0", TypeSize: 4}}, Buf: "parent"}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "f1", TypeSize: 4}}, Val: 67}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "f2", TypeSize: 4}}}, + }}}, {Key: StructKey{Name: "compare_data"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "compare_data", IsVarlen: true}, Fields: []Type{ &StructType{Key: StructKey{Name: "align0"}, FldName: "align0"}, &StructType{Key: StructKey{Name: "syz_bf_struct0"}, FldName: "bf0"}, @@ -660,6 +665,12 @@ var syscalls_64 = []*Syscall{ {Name: "test$array2", CallName: "test", Args: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "syz_array_blob"}}}, }}, + {Name: "test$auto0", CallName: "test", Args: []Type{ + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "a", TypeSize: 8}}, Val: 66}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "b", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "auto_struct0"}}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "c", TypeSize: 8}}, Buf: "b"}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "d", TypeSize: 4}}}, + }}, {Name: "test$bf0", CallName: "test", Args: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "syz_bf_struct0"}}}, }}, @@ -929,4 +940,4 @@ var consts_64 = []ConstValue{ {Name: "SYS_unsupported"}, } -const revision_64 = "82736d421a5d52db6df0775561f1e59cc6cb9014" +const revision_64 = "ece48c7de48771745acdea340f4c52c47e058e65" -- cgit mrf-deployment