[fidl][go] Fix bug with reserved union variants in v1
This CL fixes v1 union encoding in Go for unions with reserved variants.
Before, the marshaling code assumed the union tag was the same as the
xunion ordinal. Now, it looks up the ordinal explicitly.
This also includes some unrelated new GIDL tests, as other changes have
been made since the last regen commit in third_party/go.
Test: fx run-test go_fidl_tests
Fixed: 41690
Change-Id: Ie3e508794143c10fd063a6df459ea7a0d3d1ed2a
diff --git a/src/syscall/zx/fidl/conformance/impl.go b/src/syscall/zx/fidl/conformance/impl.go
index f272586..0b332bc 100644
--- a/src/syscall/zx/fidl/conformance/impl.go
+++ b/src/syscall/zx/fidl/conformance/impl.go
@@ -2,12 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// GENERATED FILE: Do not edit!
-//
-// To rebuild this file, invoke third_party/go/regen-fidl.
+// Code generated by tools/fidl/gidl-conformance-suite/regen.sh; DO NOT EDIT.
// +build fuchsia
+//
+// Code generated by fidlgen; DO NOT EDIT.
+
package conformance
import (
@@ -15,6 +16,255 @@
_bindings "syscall/zx/fidl"
)
+type TestXUnionInTable struct {
+ _ struct{} `fidl:"s,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
+ Value XUnionInTable `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+}
+
+var _mTestXUnionInTable = _bindings.CreateLazyMarshaler(TestXUnionInTable{})
+
+func (msg *TestXUnionInTable) Marshaler() _bindings.Marshaler {
+ return _mTestXUnionInTable
+}
+
+type InterfaceConfig struct {
+ _ struct{} `fidl:"s,48,8" fidl_size_v1:"40" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"40" fidl_alignment_v1_no_ee:"8"`
+ Name string `fidl:"0," fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+ IpAddressConfig IpAddressConfig `fidl:"16" fidl_offset_v1:"16" fidl_offset_v1_no_ee:"16"`
+}
+
+var _mInterfaceConfig = _bindings.CreateLazyMarshaler(InterfaceConfig{})
+
+func (msg *InterfaceConfig) Marshaler() _bindings.Marshaler {
+ return _mInterfaceConfig
+}
+
+type TestAddEthernetDeviceRequest struct {
+ _ struct{} `fidl:"s,72,8" fidl_size_v1:"64" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"64" fidl_alignment_v1_no_ee:"8"`
+ TopologicalPath string `fidl:"0," fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+ Config InterfaceConfig `fidl:"16" fidl_offset_v1:"16" fidl_offset_v1_no_ee:"16"`
+ ThisShouldBeAHandle uint32 `fidl:"64" fidl_offset_v1:"56" fidl_offset_v1_no_ee:"56"`
+}
+
+var _mTestAddEthernetDeviceRequest = _bindings.CreateLazyMarshaler(TestAddEthernetDeviceRequest{})
+
+func (msg *TestAddEthernetDeviceRequest) Marshaler() _bindings.Marshaler {
+ return _mTestAddEthernetDeviceRequest
+}
+
+type NodeAttributes struct {
+ _ struct{} `fidl:"s,56,8" fidl_size_v1:"56" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"56" fidl_alignment_v1_no_ee:"8"`
+ Mode uint32 `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+ Id uint64 `fidl:"8" fidl_offset_v1:"8" fidl_offset_v1_no_ee:"8"`
+ ContentSize uint64 `fidl:"16" fidl_offset_v1:"16" fidl_offset_v1_no_ee:"16"`
+ StorageSize uint64 `fidl:"24" fidl_offset_v1:"24" fidl_offset_v1_no_ee:"24"`
+ LinkCount uint64 `fidl:"32" fidl_offset_v1:"32" fidl_offset_v1_no_ee:"32"`
+ CreationTime uint64 `fidl:"40" fidl_offset_v1:"40" fidl_offset_v1_no_ee:"40"`
+ ModificationTime uint64 `fidl:"48" fidl_offset_v1:"48" fidl_offset_v1_no_ee:"48"`
+}
+
+var _mNodeAttributes = _bindings.CreateLazyMarshaler(NodeAttributes{})
+
+func (msg *NodeAttributes) Marshaler() _bindings.Marshaler {
+ return _mNodeAttributes
+}
+
+type FileGetAttrResponse struct {
+ _ struct{} `fidl:"s,64,8" fidl_size_v1:"64" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"64" fidl_alignment_v1_no_ee:"8"`
+ S int32 `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+ Attributes NodeAttributes `fidl:"8" fidl_offset_v1:"8" fidl_offset_v1_no_ee:"8"`
+}
+
+var _mFileGetAttrResponse = _bindings.CreateLazyMarshaler(FileGetAttrResponse{})
+
+func (msg *FileGetAttrResponse) Marshaler() _bindings.Marshaler {
+ return _mFileGetAttrResponse
+}
+
+type UnionWithBoundStringStruct struct {
+ _ struct{} `fidl:"s,24,8" fidl_size_v1:"24" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"24" fidl_alignment_v1_no_ee:"8"`
+ V UnionWithBoundString `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+}
+
+var _mUnionWithBoundStringStruct = _bindings.CreateLazyMarshaler(UnionWithBoundStringStruct{})
+
+func (msg *UnionWithBoundStringStruct) Marshaler() _bindings.Marshaler {
+ return _mUnionWithBoundStringStruct
+}
+
+type SingleVariantUnionStruct struct {
+ _ struct{} `fidl:"s,8,4" fidl_size_v1:"24" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"24" fidl_alignment_v1_no_ee:"8"`
+ U SingleVariantUnion `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+}
+
+var _mSingleVariantUnionStruct = _bindings.CreateLazyMarshaler(SingleVariantUnionStruct{})
+
+func (msg *SingleVariantUnionStruct) Marshaler() _bindings.Marshaler {
+ return _mSingleVariantUnionStruct
+}
+
+type ReverseOrdinalUnionStruct struct {
+ _ struct{} `fidl:"s,16,8" fidl_size_v1:"24" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"24" fidl_alignment_v1_no_ee:"8"`
+ U ReverseOrdinalUnion `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+}
+
+var _mReverseOrdinalUnionStruct = _bindings.CreateLazyMarshaler(ReverseOrdinalUnionStruct{})
+
+func (msg *ReverseOrdinalUnionStruct) Marshaler() _bindings.Marshaler {
+ return _mReverseOrdinalUnionStruct
+}
+
+type StructWithInt struct {
+ _ struct{} `fidl:"s,4,4" fidl_size_v1:"4" fidl_alignment_v1:"4" fidl_size_v1_no_ee:"4" fidl_alignment_v1_no_ee:"4"`
+ X int32 `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+}
+
+var _mStructWithInt = _bindings.CreateLazyMarshaler(StructWithInt{})
+
+func (msg *StructWithInt) Marshaler() _bindings.Marshaler {
+ return _mStructWithInt
+}
+
+type StructWithArrays struct {
+ _ struct{} `fidl:"s,120,8" fidl_size_v1:"120" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"120" fidl_alignment_v1_no_ee:"8"`
+ ArrInt [2]int32 `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+ ArrString [2]string `fidl:"8," fidl_offset_v1:"8" fidl_offset_v1_no_ee:"8"`
+ ArrNullableString [2]*string `fidl:"40," fidl_offset_v1:"40" fidl_offset_v1_no_ee:"40"`
+ ArrStruct [2]StructWithInt `fidl:"72" fidl_offset_v1:"72" fidl_offset_v1_no_ee:"72"`
+ ArrNullableStruct [2]*StructWithInt `fidl:"80" fidl_offset_v1:"80" fidl_offset_v1_no_ee:"80"`
+ ArrArrInt [2][3]int32 `fidl:"96" fidl_offset_v1:"96" fidl_offset_v1_no_ee:"96"`
+}
+
+var _mStructWithArrays = _bindings.CreateLazyMarshaler(StructWithArrays{})
+
+func (msg *StructWithArrays) Marshaler() _bindings.Marshaler {
+ return _mStructWithArrays
+}
+
+type StructWithVectors struct {
+ _ struct{} `fidl:"s,112,8" fidl_size_v1:"112" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"112" fidl_alignment_v1_no_ee:"8"`
+ VecEmpty []int32 `fidl:"0," fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+ VecInt []int32 `fidl:"16," fidl_offset_v1:"16" fidl_offset_v1_no_ee:"16"`
+ VecString []string `fidl:"32,," fidl_offset_v1:"32" fidl_offset_v1_no_ee:"32"`
+ VecNullableString []*string `fidl:"48,," fidl_offset_v1:"48" fidl_offset_v1_no_ee:"48"`
+ VecStruct []StructWithInt `fidl:"64," fidl_offset_v1:"64" fidl_offset_v1_no_ee:"64"`
+ VecNullableStruct []*StructWithInt `fidl:"80," fidl_offset_v1:"80" fidl_offset_v1_no_ee:"80"`
+ VecVecInt [][]int32 `fidl:"96,," fidl_offset_v1:"96" fidl_offset_v1_no_ee:"96"`
+}
+
+var _mStructWithVectors = _bindings.CreateLazyMarshaler(StructWithVectors{})
+
+func (msg *StructWithVectors) Marshaler() _bindings.Marshaler {
+ return _mStructWithVectors
+}
+
+type EmptyStruct struct {
+ _ struct{} `fidl:"s,1,1" fidl_size_v1:"1" fidl_alignment_v1:"1" fidl_size_v1_no_ee:"1" fidl_alignment_v1_no_ee:"1"`
+}
+
+var _mEmptyStruct = _bindings.CreateLazyMarshaler(EmptyStruct{})
+
+func (msg *EmptyStruct) Marshaler() _bindings.Marshaler {
+ return _mEmptyStruct
+}
+
+type EmptyStructSandwich struct {
+ _ struct{} `fidl:"s,40,8" fidl_size_v1:"40" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"40" fidl_alignment_v1_no_ee:"8"`
+ Before string `fidl:"0," fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+ Es EmptyStruct `fidl:"16" fidl_offset_v1:"16" fidl_offset_v1_no_ee:"16"`
+ After string `fidl:"24," fidl_offset_v1:"24" fidl_offset_v1_no_ee:"24"`
+}
+
+var _mEmptyStructSandwich = _bindings.CreateLazyMarshaler(EmptyStructSandwich{})
+
+func (msg *EmptyStructSandwich) Marshaler() _bindings.Marshaler {
+ return _mEmptyStructSandwich
+}
+
+type Uint8Uint16Uint32Uint64 struct {
+ _ struct{} `fidl:"s,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
+ F1 uint8 `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+ F2 uint16 `fidl:"2" fidl_offset_v1:"2" fidl_offset_v1_no_ee:"2"`
+ F3 uint32 `fidl:"4" fidl_offset_v1:"4" fidl_offset_v1_no_ee:"4"`
+ F4 uint64 `fidl:"8" fidl_offset_v1:"8" fidl_offset_v1_no_ee:"8"`
+}
+
+var _mUint8Uint16Uint32Uint64 = _bindings.CreateLazyMarshaler(Uint8Uint16Uint32Uint64{})
+
+func (msg *Uint8Uint16Uint32Uint64) Marshaler() _bindings.Marshaler {
+ return _mUint8Uint16Uint32Uint64
+}
+
+type Uint64Uint32Uint16Uint8 struct {
+ _ struct{} `fidl:"s,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
+ F1 uint64 `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+ F2 uint32 `fidl:"8" fidl_offset_v1:"8" fidl_offset_v1_no_ee:"8"`
+ F3 uint16 `fidl:"12" fidl_offset_v1:"12" fidl_offset_v1_no_ee:"12"`
+ F4 uint8 `fidl:"14" fidl_offset_v1:"14" fidl_offset_v1_no_ee:"14"`
+}
+
+var _mUint64Uint32Uint16Uint8 = _bindings.CreateLazyMarshaler(Uint64Uint32Uint16Uint8{})
+
+func (msg *Uint64Uint32Uint16Uint8) Marshaler() _bindings.Marshaler {
+ return _mUint64Uint32Uint16Uint8
+}
+
+type Length2StringWrapper struct {
+ _ struct{} `fidl:"s,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
+ Length2String string `fidl:"0,2" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+}
+
+var _mLength2StringWrapper = _bindings.CreateLazyMarshaler(Length2StringWrapper{})
+
+func (msg *Length2StringWrapper) Marshaler() _bindings.Marshaler {
+ return _mLength2StringWrapper
+}
+
+type StringWrapper struct {
+ _ struct{} `fidl:"s,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
+ Str string `fidl:"0," fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+}
+
+var _mStringWrapper = _bindings.CreateLazyMarshaler(StringWrapper{})
+
+func (msg *StringWrapper) Marshaler() _bindings.Marshaler {
+ return _mStringWrapper
+}
+
+type StructOfSimpleTable struct {
+ _ struct{} `fidl:"s,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
+ Table SimpleTable `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+}
+
+var _mStructOfSimpleTable = _bindings.CreateLazyMarshaler(StructOfSimpleTable{})
+
+func (msg *StructOfSimpleTable) Marshaler() _bindings.Marshaler {
+ return _mStructOfSimpleTable
+}
+
+type SimpleTableThenUint64 struct {
+ _ struct{} `fidl:"s,24,8" fidl_size_v1:"24" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"24" fidl_alignment_v1_no_ee:"8"`
+ Table SimpleTable `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+ Number uint64 `fidl:"16" fidl_offset_v1:"16" fidl_offset_v1_no_ee:"16"`
+}
+
+var _mSimpleTableThenUint64 = _bindings.CreateLazyMarshaler(SimpleTableThenUint64{})
+
+func (msg *SimpleTableThenUint64) Marshaler() _bindings.Marshaler {
+ return _mSimpleTableThenUint64
+}
+
+type StructOfTableWithStringAndVector struct {
+ _ struct{} `fidl:"s,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
+ Table TableWithStringAndVector `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+}
+
+var _mStructOfTableWithStringAndVector = _bindings.CreateLazyMarshaler(StructOfTableWithStringAndVector{})
+
+func (msg *StructOfTableWithStringAndVector) Marshaler() _bindings.Marshaler {
+ return _mStructOfTableWithStringAndVector
+}
+
type ThreeByte struct {
_ struct{} `fidl:"s,3,1" fidl_size_v1:"3" fidl_alignment_v1:"1" fidl_size_v1_no_ee:"3" fidl_alignment_v1_no_ee:"1"`
Elem1 uint8 `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
@@ -110,132 +360,6 @@
return _mFiveByteInArray
}
-type StructWithInt struct {
- _ struct{} `fidl:"s,4,4" fidl_size_v1:"4" fidl_alignment_v1:"4" fidl_size_v1_no_ee:"4" fidl_alignment_v1_no_ee:"4"`
- X int32 `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
-}
-
-var _mStructWithInt = _bindings.CreateLazyMarshaler(StructWithInt{})
-
-func (msg *StructWithInt) Marshaler() _bindings.Marshaler {
- return _mStructWithInt
-}
-
-type StructWithArrays struct {
- _ struct{} `fidl:"s,120,8" fidl_size_v1:"120" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"120" fidl_alignment_v1_no_ee:"8"`
- ArrInt [2]int32 `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
- ArrString [2]string `fidl:"8," fidl_offset_v1:"8" fidl_offset_v1_no_ee:"8"`
- ArrNullableString [2]*string `fidl:"40," fidl_offset_v1:"40" fidl_offset_v1_no_ee:"40"`
- ArrStruct [2]StructWithInt `fidl:"72" fidl_offset_v1:"72" fidl_offset_v1_no_ee:"72"`
- ArrNullableStruct [2]*StructWithInt `fidl:"80" fidl_offset_v1:"80" fidl_offset_v1_no_ee:"80"`
- ArrArrInt [2][3]int32 `fidl:"96" fidl_offset_v1:"96" fidl_offset_v1_no_ee:"96"`
-}
-
-var _mStructWithArrays = _bindings.CreateLazyMarshaler(StructWithArrays{})
-
-func (msg *StructWithArrays) Marshaler() _bindings.Marshaler {
- return _mStructWithArrays
-}
-
-type StructWithVectors struct {
- _ struct{} `fidl:"s,112,8" fidl_size_v1:"112" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"112" fidl_alignment_v1_no_ee:"8"`
- VecEmpty []int32 `fidl:"0," fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
- VecInt []int32 `fidl:"16," fidl_offset_v1:"16" fidl_offset_v1_no_ee:"16"`
- VecString []string `fidl:"32,," fidl_offset_v1:"32" fidl_offset_v1_no_ee:"32"`
- VecNullableString []*string `fidl:"48,," fidl_offset_v1:"48" fidl_offset_v1_no_ee:"48"`
- VecStruct []StructWithInt `fidl:"64," fidl_offset_v1:"64" fidl_offset_v1_no_ee:"64"`
- VecNullableStruct []*StructWithInt `fidl:"80," fidl_offset_v1:"80" fidl_offset_v1_no_ee:"80"`
- VecVecInt [][]int32 `fidl:"96,," fidl_offset_v1:"96" fidl_offset_v1_no_ee:"96"`
-}
-
-var _mStructWithVectors = _bindings.CreateLazyMarshaler(StructWithVectors{})
-
-func (msg *StructWithVectors) Marshaler() _bindings.Marshaler {
- return _mStructWithVectors
-}
-
-type TestXUnionInTable struct {
- _ struct{} `fidl:"s,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
- Value XUnionInTable `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
-}
-
-var _mTestXUnionInTable = _bindings.CreateLazyMarshaler(TestXUnionInTable{})
-
-func (msg *TestXUnionInTable) Marshaler() _bindings.Marshaler {
- return _mTestXUnionInTable
-}
-
-type InterfaceConfig struct {
- _ struct{} `fidl:"s,48,8" fidl_size_v1:"40" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"40" fidl_alignment_v1_no_ee:"8"`
- Name string `fidl:"0," fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
- IpAddressConfig IpAddressConfig `fidl:"16" fidl_offset_v1:"16" fidl_offset_v1_no_ee:"16"`
-}
-
-var _mInterfaceConfig = _bindings.CreateLazyMarshaler(InterfaceConfig{})
-
-func (msg *InterfaceConfig) Marshaler() _bindings.Marshaler {
- return _mInterfaceConfig
-}
-
-type TestAddEthernetDeviceRequest struct {
- _ struct{} `fidl:"s,72,8" fidl_size_v1:"64" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"64" fidl_alignment_v1_no_ee:"8"`
- TopologicalPath string `fidl:"0," fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
- Config InterfaceConfig `fidl:"16" fidl_offset_v1:"16" fidl_offset_v1_no_ee:"16"`
- ThisShouldBeAHandle uint32 `fidl:"64" fidl_offset_v1:"56" fidl_offset_v1_no_ee:"56"`
-}
-
-var _mTestAddEthernetDeviceRequest = _bindings.CreateLazyMarshaler(TestAddEthernetDeviceRequest{})
-
-func (msg *TestAddEthernetDeviceRequest) Marshaler() _bindings.Marshaler {
- return _mTestAddEthernetDeviceRequest
-}
-
-type NodeAttributes struct {
- _ struct{} `fidl:"s,56,8" fidl_size_v1:"56" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"56" fidl_alignment_v1_no_ee:"8"`
- Mode uint32 `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
- Id uint64 `fidl:"8" fidl_offset_v1:"8" fidl_offset_v1_no_ee:"8"`
- ContentSize uint64 `fidl:"16" fidl_offset_v1:"16" fidl_offset_v1_no_ee:"16"`
- StorageSize uint64 `fidl:"24" fidl_offset_v1:"24" fidl_offset_v1_no_ee:"24"`
- LinkCount uint64 `fidl:"32" fidl_offset_v1:"32" fidl_offset_v1_no_ee:"32"`
- CreationTime uint64 `fidl:"40" fidl_offset_v1:"40" fidl_offset_v1_no_ee:"40"`
- ModificationTime uint64 `fidl:"48" fidl_offset_v1:"48" fidl_offset_v1_no_ee:"48"`
-}
-
-var _mNodeAttributes = _bindings.CreateLazyMarshaler(NodeAttributes{})
-
-func (msg *NodeAttributes) Marshaler() _bindings.Marshaler {
- return _mNodeAttributes
-}
-
-type FileGetAttrResponse struct {
- _ struct{} `fidl:"s,64,8" fidl_size_v1:"64" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"64" fidl_alignment_v1_no_ee:"8"`
- S int32 `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
- Attributes NodeAttributes `fidl:"8" fidl_offset_v1:"8" fidl_offset_v1_no_ee:"8"`
-}
-
-var _mFileGetAttrResponse = _bindings.CreateLazyMarshaler(FileGetAttrResponse{})
-
-func (msg *FileGetAttrResponse) Marshaler() _bindings.Marshaler {
- return _mFileGetAttrResponse
-}
-
-type StructWithOptionals struct {
- _ struct{} `fidl:"s,104,8" fidl_size_v1:"128" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"128" fidl_alignment_v1_no_ee:"8"`
- S EmptyStruct `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
- S2 *EmptyStruct `fidl:"8" fidl_offset_v1:"8" fidl_offset_v1_no_ee:"8"`
- T TableWithEmptyStruct `fidl:"16" fidl_offset_v1:"16" fidl_offset_v1_no_ee:"16"`
- Xu XUnionWithEmptyStruct `fidl:"32" fidl_offset_v1:"32" fidl_offset_v1_no_ee:"32"`
- Xu2 *XUnionWithEmptyStruct `fidl:"56" fidl_offset_v1:"56" fidl_offset_v1_no_ee:"56"`
- U UnionWithEmptyStruct `fidl:"80" fidl_offset_v1:"80" fidl_offset_v1_no_ee:"80"`
- U2 *UnionWithEmptyStruct `fidl:"96" fidl_offset_v1:"104" fidl_offset_v1_no_ee:"104"`
-}
-
-var _mStructWithOptionals = _bindings.CreateLazyMarshaler(StructWithOptionals{})
-
-func (msg *StructWithOptionals) Marshaler() _bindings.Marshaler {
- return _mStructWithOptionals
-}
-
type MyBool struct {
_ struct{} `fidl:"s,1,1" fidl_size_v1:"1" fidl_alignment_v1:"1" fidl_size_v1_no_ee:"1" fidl_alignment_v1_no_ee:"1"`
Value bool `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
@@ -368,111 +492,21 @@
return _mMyFloat64
}
-type Length2StringWrapper struct {
- _ struct{} `fidl:"s,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
- Length2String string `fidl:"0,2" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+type StructWithOptionals struct {
+ _ struct{} `fidl:"s,104,8" fidl_size_v1:"128" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"128" fidl_alignment_v1_no_ee:"8"`
+ S EmptyStruct `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
+ S2 *EmptyStruct `fidl:"8" fidl_offset_v1:"8" fidl_offset_v1_no_ee:"8"`
+ T TableWithEmptyStruct `fidl:"16" fidl_offset_v1:"16" fidl_offset_v1_no_ee:"16"`
+ Xu XUnionWithEmptyStruct `fidl:"32" fidl_offset_v1:"32" fidl_offset_v1_no_ee:"32"`
+ Xu2 *XUnionWithEmptyStruct `fidl:"56" fidl_offset_v1:"56" fidl_offset_v1_no_ee:"56"`
+ U UnionWithEmptyStruct `fidl:"80" fidl_offset_v1:"80" fidl_offset_v1_no_ee:"80"`
+ U2 *UnionWithEmptyStruct `fidl:"96" fidl_offset_v1:"104" fidl_offset_v1_no_ee:"104"`
}
-var _mLength2StringWrapper = _bindings.CreateLazyMarshaler(Length2StringWrapper{})
+var _mStructWithOptionals = _bindings.CreateLazyMarshaler(StructWithOptionals{})
-func (msg *Length2StringWrapper) Marshaler() _bindings.Marshaler {
- return _mLength2StringWrapper
-}
-
-type StringWrapper struct {
- _ struct{} `fidl:"s,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
- Str string `fidl:"0," fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
-}
-
-var _mStringWrapper = _bindings.CreateLazyMarshaler(StringWrapper{})
-
-func (msg *StringWrapper) Marshaler() _bindings.Marshaler {
- return _mStringWrapper
-}
-
-type EmptyStruct struct {
- _ struct{} `fidl:"s,1,1" fidl_size_v1:"1" fidl_alignment_v1:"1" fidl_size_v1_no_ee:"1" fidl_alignment_v1_no_ee:"1"`
-}
-
-var _mEmptyStruct = _bindings.CreateLazyMarshaler(EmptyStruct{})
-
-func (msg *EmptyStruct) Marshaler() _bindings.Marshaler {
- return _mEmptyStruct
-}
-
-type EmptyStructSandwich struct {
- _ struct{} `fidl:"s,40,8" fidl_size_v1:"40" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"40" fidl_alignment_v1_no_ee:"8"`
- Before string `fidl:"0," fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
- Es EmptyStruct `fidl:"16" fidl_offset_v1:"16" fidl_offset_v1_no_ee:"16"`
- After string `fidl:"24," fidl_offset_v1:"24" fidl_offset_v1_no_ee:"24"`
-}
-
-var _mEmptyStructSandwich = _bindings.CreateLazyMarshaler(EmptyStructSandwich{})
-
-func (msg *EmptyStructSandwich) Marshaler() _bindings.Marshaler {
- return _mEmptyStructSandwich
-}
-
-type Uint8Uint16Uint32Uint64 struct {
- _ struct{} `fidl:"s,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
- F1 uint8 `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
- F2 uint16 `fidl:"2" fidl_offset_v1:"2" fidl_offset_v1_no_ee:"2"`
- F3 uint32 `fidl:"4" fidl_offset_v1:"4" fidl_offset_v1_no_ee:"4"`
- F4 uint64 `fidl:"8" fidl_offset_v1:"8" fidl_offset_v1_no_ee:"8"`
-}
-
-var _mUint8Uint16Uint32Uint64 = _bindings.CreateLazyMarshaler(Uint8Uint16Uint32Uint64{})
-
-func (msg *Uint8Uint16Uint32Uint64) Marshaler() _bindings.Marshaler {
- return _mUint8Uint16Uint32Uint64
-}
-
-type Uint64Uint32Uint16Uint8 struct {
- _ struct{} `fidl:"s,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
- F1 uint64 `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
- F2 uint32 `fidl:"8" fidl_offset_v1:"8" fidl_offset_v1_no_ee:"8"`
- F3 uint16 `fidl:"12" fidl_offset_v1:"12" fidl_offset_v1_no_ee:"12"`
- F4 uint8 `fidl:"14" fidl_offset_v1:"14" fidl_offset_v1_no_ee:"14"`
-}
-
-var _mUint64Uint32Uint16Uint8 = _bindings.CreateLazyMarshaler(Uint64Uint32Uint16Uint8{})
-
-func (msg *Uint64Uint32Uint16Uint8) Marshaler() _bindings.Marshaler {
- return _mUint64Uint32Uint16Uint8
-}
-
-type StructOfSimpleTable struct {
- _ struct{} `fidl:"s,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
- Table SimpleTable `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
-}
-
-var _mStructOfSimpleTable = _bindings.CreateLazyMarshaler(StructOfSimpleTable{})
-
-func (msg *StructOfSimpleTable) Marshaler() _bindings.Marshaler {
- return _mStructOfSimpleTable
-}
-
-type SimpleTableThenUint64 struct {
- _ struct{} `fidl:"s,24,8" fidl_size_v1:"24" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"24" fidl_alignment_v1_no_ee:"8"`
- Table SimpleTable `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
- Number uint64 `fidl:"16" fidl_offset_v1:"16" fidl_offset_v1_no_ee:"16"`
-}
-
-var _mSimpleTableThenUint64 = _bindings.CreateLazyMarshaler(SimpleTableThenUint64{})
-
-func (msg *SimpleTableThenUint64) Marshaler() _bindings.Marshaler {
- return _mSimpleTableThenUint64
-}
-
-type StructOfTableWithStringAndVector struct {
- _ struct{} `fidl:"s,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
- Table TableWithStringAndVector `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
-}
-
-var _mStructOfTableWithStringAndVector = _bindings.CreateLazyMarshaler(StructOfTableWithStringAndVector{})
-
-func (msg *StructOfTableWithStringAndVector) Marshaler() _bindings.Marshaler {
- return _mStructOfTableWithStringAndVector
+func (msg *StructWithOptionals) Marshaler() _bindings.Marshaler {
+ return _mStructWithOptionals
}
type StructSize16Align8 struct {
@@ -998,28 +1032,6 @@
return _mCreateComponentRequest
}
-type UnionWithBoundStringStruct struct {
- _ struct{} `fidl:"s,24,8" fidl_size_v1:"24" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"24" fidl_alignment_v1_no_ee:"8"`
- V UnionWithBoundString `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
-}
-
-var _mUnionWithBoundStringStruct = _bindings.CreateLazyMarshaler(UnionWithBoundStringStruct{})
-
-func (msg *UnionWithBoundStringStruct) Marshaler() _bindings.Marshaler {
- return _mUnionWithBoundStringStruct
-}
-
-type SingleVariantUnionStruct struct {
- _ struct{} `fidl:"s,8,4" fidl_size_v1:"24" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"24" fidl_alignment_v1_no_ee:"8"`
- U SingleVariantUnion `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
-}
-
-var _mSingleVariantUnionStruct = _bindings.CreateLazyMarshaler(SingleVariantUnionStruct{})
-
-func (msg *SingleVariantUnionStruct) Marshaler() _bindings.Marshaler {
- return _mSingleVariantUnionStruct
-}
-
type Int64Struct struct {
_ struct{} `fidl:"s,8,8" fidl_size_v1:"8" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"8" fidl_alignment_v1_no_ee:"8"`
X int64 `fidl:"0" fidl_offset_v1:"0" fidl_offset_v1_no_ee:"0"`
@@ -1119,6 +1131,113 @@
return _u
}
+type I_unionWithBoundStringTag uint32
+
+const (
+ _ I_unionWithBoundStringTag = iota
+ UnionWithBoundStringBoundFiveStr
+)
+
+type UnionWithBoundString struct {
+ I_unionWithBoundStringTag `fidl:"u,24,8" fidl_size_v1:"24" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"24" fidl_alignment_v1_no_ee:"8"`
+ BoundFiveStr string `fidl:"1,5"`
+}
+
+func (u *UnionWithBoundString) Which() I_unionWithBoundStringTag {
+ return u.I_unionWithBoundStringTag
+}
+
+func (u *UnionWithBoundString) SetBoundFiveStr(boundFiveStr string) {
+ u.I_unionWithBoundStringTag = UnionWithBoundStringBoundFiveStr
+ u.BoundFiveStr = boundFiveStr
+}
+
+func UnionWithBoundStringWithBoundFiveStr(boundFiveStr string) UnionWithBoundString {
+ var _u UnionWithBoundString
+ _u.SetBoundFiveStr(boundFiveStr)
+ return _u
+}
+
+type I_singleVariantUnionTag uint32
+
+const (
+ _ I_singleVariantUnionTag = iota
+ SingleVariantUnionX
+)
+
+type SingleVariantUnion struct {
+ I_singleVariantUnionTag `fidl:"u,8,4" fidl_size_v1:"24" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"24" fidl_alignment_v1_no_ee:"8"`
+ X uint32 `fidl:"1"`
+}
+
+func (u *SingleVariantUnion) Which() I_singleVariantUnionTag {
+ return u.I_singleVariantUnionTag
+}
+
+func (u *SingleVariantUnion) SetX(x uint32) {
+ u.I_singleVariantUnionTag = SingleVariantUnionX
+ u.X = x
+}
+
+func SingleVariantUnionWithX(x uint32) SingleVariantUnion {
+ var _u SingleVariantUnion
+ _u.SetX(x)
+ return _u
+}
+
+type I_reverseOrdinalUnionTag uint32
+
+const (
+ _ I_reverseOrdinalUnionTag = iota
+ ReverseOrdinalUnionZ
+ ReverseOrdinalUnionY
+ ReverseOrdinalUnionX
+)
+
+type ReverseOrdinalUnion struct {
+ I_reverseOrdinalUnionTag `fidl:"u,16,8" fidl_size_v1:"24" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"24" fidl_alignment_v1_no_ee:"8"`
+ Z uint32 `fidl:"1"`
+ Y bool `fidl:"2"`
+ X int64 `fidl:"4"`
+}
+
+func (u *ReverseOrdinalUnion) Which() I_reverseOrdinalUnionTag {
+ return u.I_reverseOrdinalUnionTag
+}
+
+func (u *ReverseOrdinalUnion) SetZ(z uint32) {
+ u.I_reverseOrdinalUnionTag = ReverseOrdinalUnionZ
+ u.Z = z
+}
+
+func ReverseOrdinalUnionWithZ(z uint32) ReverseOrdinalUnion {
+ var _u ReverseOrdinalUnion
+ _u.SetZ(z)
+ return _u
+}
+
+func (u *ReverseOrdinalUnion) SetY(y bool) {
+ u.I_reverseOrdinalUnionTag = ReverseOrdinalUnionY
+ u.Y = y
+}
+
+func ReverseOrdinalUnionWithY(y bool) ReverseOrdinalUnion {
+ var _u ReverseOrdinalUnion
+ _u.SetY(y)
+ return _u
+}
+
+func (u *ReverseOrdinalUnion) SetX(x int64) {
+ u.I_reverseOrdinalUnionTag = ReverseOrdinalUnionX
+ u.X = x
+}
+
+func ReverseOrdinalUnionWithX(x int64) ReverseOrdinalUnion {
+ var _u ReverseOrdinalUnion
+ _u.SetX(x)
+ return _u
+}
+
type I_unionWithEmptyStructTag uint32
const (
@@ -1740,60 +1859,6 @@
return _u
}
-type I_unionWithBoundStringTag uint32
-
-const (
- _ I_unionWithBoundStringTag = iota
- UnionWithBoundStringBoundFiveStr
-)
-
-type UnionWithBoundString struct {
- I_unionWithBoundStringTag `fidl:"u,24,8" fidl_size_v1:"24" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"24" fidl_alignment_v1_no_ee:"8"`
- BoundFiveStr string `fidl:"1,5"`
-}
-
-func (u *UnionWithBoundString) Which() I_unionWithBoundStringTag {
- return u.I_unionWithBoundStringTag
-}
-
-func (u *UnionWithBoundString) SetBoundFiveStr(boundFiveStr string) {
- u.I_unionWithBoundStringTag = UnionWithBoundStringBoundFiveStr
- u.BoundFiveStr = boundFiveStr
-}
-
-func UnionWithBoundStringWithBoundFiveStr(boundFiveStr string) UnionWithBoundString {
- var _u UnionWithBoundString
- _u.SetBoundFiveStr(boundFiveStr)
- return _u
-}
-
-type I_singleVariantUnionTag uint32
-
-const (
- _ I_singleVariantUnionTag = iota
- SingleVariantUnionX
-)
-
-type SingleVariantUnion struct {
- I_singleVariantUnionTag `fidl:"u,8,4" fidl_size_v1:"24" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"24" fidl_alignment_v1_no_ee:"8"`
- X uint32 `fidl:"1"`
-}
-
-func (u *SingleVariantUnion) Which() I_singleVariantUnionTag {
- return u.I_singleVariantUnionTag
-}
-
-func (u *SingleVariantUnion) SetX(x uint32) {
- u.I_singleVariantUnionTag = SingleVariantUnionX
- u.X = x
-}
-
-func SingleVariantUnionWithX(x uint32) SingleVariantUnion {
- var _u SingleVariantUnion
- _u.SetX(x)
- return _u
-}
-
type I_simpleUnionTag uint32
const (
@@ -2228,36 +2293,6 @@
u.AfterPresent = false
}
-type TableWithEmptyStruct struct {
- _ struct{} `fidl:"t,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
- S EmptyStruct `fidl:"1"`
- SPresent bool
-}
-
-func (u *TableWithEmptyStruct) SetS(s EmptyStruct) {
- u.S = s
- u.SPresent = true
-}
-
-func (u *TableWithEmptyStruct) GetS() EmptyStruct {
- return u.S
-}
-
-func (u *TableWithEmptyStruct) GetSWithDefault(_default EmptyStruct) EmptyStruct {
- if !u.HasS() {
- return _default
- }
- return u.S
-}
-
-func (u *TableWithEmptyStruct) HasS() bool {
- return u.SPresent
-}
-
-func (u *TableWithEmptyStruct) ClearS() {
- u.SPresent = false
-}
-
type SimpleTable struct {
_ struct{} `fidl:"t,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
X int64 `fidl:"1"`
@@ -2396,6 +2431,36 @@
u.BazPresent = false
}
+type TableWithEmptyStruct struct {
+ _ struct{} `fidl:"t,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
+ S EmptyStruct `fidl:"1"`
+ SPresent bool
+}
+
+func (u *TableWithEmptyStruct) SetS(s EmptyStruct) {
+ u.S = s
+ u.SPresent = true
+}
+
+func (u *TableWithEmptyStruct) GetS() EmptyStruct {
+ return u.S
+}
+
+func (u *TableWithEmptyStruct) GetSWithDefault(_default EmptyStruct) EmptyStruct {
+ if !u.HasS() {
+ return _default
+ }
+ return u.S
+}
+
+func (u *TableWithEmptyStruct) HasS() bool {
+ return u.SPresent
+}
+
+func (u *TableWithEmptyStruct) ClearS() {
+ u.SPresent = false
+}
+
type TableStructWithReservedSandwich struct {
_ struct{} `fidl:"t,16,8" fidl_size_v1:"16" fidl_alignment_v1:"8" fidl_size_v1_no_ee:"16" fidl_alignment_v1_no_ee:"8"`
S1 StructSize3Align1 `fidl:"2"`
diff --git a/src/syscall/zx/fidl/encoding_new.go b/src/syscall/zx/fidl/encoding_new.go
index 2359884..d71f256 100644
--- a/src/syscall/zx/fidl/encoding_new.go
+++ b/src/syscall/zx/fidl/encoding_new.go
@@ -280,6 +280,7 @@
}
return mXUnion{
fields: ordinalToFields,
+ ordinals: ordinals,
sizeOld: sizeOld,
alignmentOld: alignmentOld,
sizeV1: sizeV1,
@@ -307,6 +308,7 @@
}
return mXUnion{
fields: ordinalToFields,
+ ordinals: m.ordinals,
unionToXunion: true,
sizeV1: m.sizeV1,
alignmentV1: m.alignmentV1,
@@ -747,6 +749,7 @@
type mXUnion struct {
fields map[int]mField
+ ordinals []int
unionToXunion bool
sizeOld, alignmentOld int
sizeV1, alignmentV1 int
@@ -768,8 +771,18 @@
}
func (m mXUnion) marshal(ctx MarshalerContext, v reflect.Value, out *encoder) error {
- // Ordinal.
- ordinal := int(v.Field(0).Uint())
+ var ordinal int
+ if m.unionToXunion {
+ // Unions store the active field index in Field(0), which could be
+ // different from the xunion ordinal if there are reserved variants.
+ fieldIndex := int(v.Field(0).Uint())
+ if !(fieldIndex >= 1 && fieldIndex <= len(m.ordinals)) {
+ return newValueError(ErrInvalidUnionTag, fieldIndex)
+ }
+ ordinal = m.ordinals[fieldIndex-1]
+ } else {
+ ordinal = int(v.Field(0).Uint())
+ }
field, ok := m.fields[ordinal]
if !ok {
return newValueError(ErrInvalidXUnionTag, ordinal)
@@ -857,11 +870,13 @@
v = v.Elem()
}
- ordinalToSet := ordinal
+ ordinalOrFieldIndex := ordinal
if m.unionToXunion {
- ordinalToSet = uint64(field.index)
+ // Unions store the active field index in Field(0), which could be
+ // different from the xunion ordinal if there are reserved variants.
+ ordinalOrFieldIndex = uint64(field.index)
}
- v.Field(0).SetUint(ordinalToSet)
+ v.Field(0).SetUint(ordinalOrFieldIndex)
var mode unmarshalEnvelopeMode
if optAllowed {
diff --git a/src/syscall/zx/fidl/fidl_test/conformance_test.go b/src/syscall/zx/fidl/fidl_test/conformance_test.go
index 1a4febc..1b087ed 100644
--- a/src/syscall/zx/fidl/fidl_test/conformance_test.go
+++ b/src/syscall/zx/fidl/fidl_test/conformance_test.go
@@ -47,7 +47,7 @@
v1.Elem3 = v10
encodeSuccessCase{
- name: "3ByteObjectAlignmentInStruct",
+ name: "3ByteObjectAlignmentInStruct_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -82,7 +82,7 @@
v1.Elem3 = v8
encodeSuccessCase{
- name: "5ByteObjectAlignmentInStruct",
+ name: "5ByteObjectAlignmentInStruct_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -123,7 +123,7 @@
v1.Elems = v14
encodeSuccessCase{
- name: "3ByteObjectAlignmentInVector",
+ name: "3ByteObjectAlignmentInVector_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -159,7 +159,7 @@
v1.Elems = v11
encodeSuccessCase{
- name: "5ByteObjectAlignmentInVector",
+ name: "5ByteObjectAlignmentInVector_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -202,7 +202,7 @@
v1.Elems = v14
encodeSuccessCase{
- name: "3ByteObjectAlignmentInArray",
+ name: "3ByteObjectAlignmentInArray_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -236,7 +236,7 @@
v1.Elems = v11
encodeSuccessCase{
- name: "5ByteObjectAlignmentInArray",
+ name: "5ByteObjectAlignmentInArray_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -254,7 +254,7 @@
v1 := conformance.EmptyStruct{}
encodeSuccessCase{
- name: "EmptyStruct",
+ name: "EmptyStruct_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -276,7 +276,7 @@
v1.After = v4
encodeSuccessCase{
- name: "EmptyStructSandwich",
+ name: "EmptyStructSandwich_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -306,7 +306,7 @@
v1.F4 = v5
encodeSuccessCase{
- name: "Uint8Uint16Uint32Uint64",
+ name: "Uint8Uint16Uint32Uint64_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -331,7 +331,7 @@
v1.F4 = v5
encodeSuccessCase{
- name: "Uint64Uint32Uint16Uint8",
+ name: "Uint64Uint32Uint16Uint8_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -350,7 +350,7 @@
v1.Table = v2
encodeSuccessCase{
- name: "SimpleTableEmpty",
+ name: "SimpleTableEmpty_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -373,7 +373,7 @@
v1.Table = v2
encodeSuccessCase{
- name: "SimpleTableXAndY",
+ name: "SimpleTableXAndY_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -406,7 +406,7 @@
v1.Table = v2
encodeSuccessCase{
- name: "SimpleTableJustY",
+ name: "SimpleTableJustY_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -440,7 +440,7 @@
v1.Table = v2
encodeSuccessCase{
- name: "TableWithStringAndVectorNoVectorContent",
+ name: "TableWithStringAndVectorNoVectorContent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -473,7 +473,7 @@
v1.Number = v5
encodeSuccessCase{
- name: "SimpleTableThenUint64",
+ name: "SimpleTableThenUint64_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -511,7 +511,7 @@
v1.After = v5
encodeSuccessCase{
- name: "InlineXUnionInStruct",
+ name: "InlineXUnionInStruct_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -540,7 +540,7 @@
v1.After = v3
encodeSuccessCase{
- name: "OptionalXUnionInStructAbsent",
+ name: "OptionalXUnionInStructAbsent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -572,7 +572,7 @@
v1.After = v5
encodeSuccessCase{
- name: "OptionalXUnionInStructPresent",
+ name: "OptionalXUnionInStructPresent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -603,7 +603,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "XUnionInTableXUnionAbsent",
+ name: "XUnionInTableXUnionAbsent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -642,7 +642,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "XUnionInTableXUnionPresent",
+ name: "XUnionInTableXUnionPresent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -679,7 +679,7 @@
v1.Xu = v2
encodeSuccessCase{
- name: "StrictXUnion",
+ name: "StrictXUnion_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -710,7 +710,7 @@
v1.ThisShouldBeAHandle = v7
encodeSuccessCase{
- name: "AddEthernetDeviceRequest",
+ name: "AddEthernetDeviceRequest_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -737,6 +737,48 @@
}
{
+ v1 := conformance.TestAddEthernetDeviceRequest{}
+ v2 := "@/dev/sys/pci/00:03.0/e1000/ethernet"
+ v1.TopologicalPath = v2
+ v3 := conformance.InterfaceConfig{}
+ v4 := "ethp0003"
+ v3.Name = v4
+ v5 := conformance.IpAddressConfig{}
+ v6 := true
+ v5.SetDhcp(v6)
+ v3.IpAddressConfig = v5
+ v1.Config = v3
+ var v7 uint32 = 4294967295
+ v1.ThisShouldBeAHandle = v7
+
+ encodeSuccessCase{
+ name: "AddEthernetDeviceRequest_v1",
+ context: fidl.MarshalerContext{
+ DecodeUnionsFromXUnionBytes: true,
+ EncodeUnionsAsXUnionBytes: true,
+ },
+ input: &v1,
+ bytes: []byte{
+ 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x40, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x79,
+ 0x73, 0x2f, 0x70, 0x63, 0x69, 0x2f, 0x30, 0x30,
+ 0x3a, 0x30, 0x33, 0x2e, 0x30, 0x2f, 0x65, 0x31,
+ 0x30, 0x30, 0x30, 0x2f, 0x65, 0x74, 0x68, 0x65,
+ 0x72, 0x6e, 0x65, 0x74, 0x00, 0x00, 0x00, 0x00,
+ 0x65, 0x74, 0x68, 0x70, 0x30, 0x30, 0x30, 0x33,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ },
+ }.check(t)
+ }
+
+ {
v1 := conformance.FileGetAttrResponse{}
var v2 int32 = 2125315759
v1.S = v2
@@ -758,7 +800,7 @@
v1.Attributes = v3
encodeSuccessCase{
- name: "FileGetAttrResponse",
+ name: "FileGetAttrResponse_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -805,7 +847,7 @@
v1.U2 = v12
encodeSuccessCase{
- name: "Optionals",
+ name: "Optionals_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -838,6 +880,69 @@
}
{
+ v1 := conformance.StructWithOptionals{}
+ v2 := conformance.EmptyStruct{}
+ v1.S = v2
+ v3 := &conformance.EmptyStruct{}
+ v1.S2 = v3
+ v4 := conformance.TableWithEmptyStruct{}
+ v5 := conformance.EmptyStruct{}
+ v4.SetS(v5)
+ v1.T = v4
+ v6 := conformance.XUnionWithEmptyStruct{}
+ v7 := conformance.EmptyStruct{}
+ v6.SetS(v7)
+ v1.Xu = v6
+ v8 := &conformance.XUnionWithEmptyStruct{}
+ v9 := conformance.EmptyStruct{}
+ v8.SetS(v9)
+ v1.Xu2 = v8
+ v10 := conformance.UnionWithEmptyStruct{}
+ v11 := conformance.EmptyStruct{}
+ v10.SetS(v11)
+ v1.U = v10
+ v12 := &conformance.UnionWithEmptyStruct{}
+ v13 := conformance.EmptyStruct{}
+ v12.SetS(v13)
+ v1.U2 = v12
+
+ encodeSuccessCase{
+ name: "Optionals_v1",
+ context: fidl.MarshalerContext{
+ DecodeUnionsFromXUnionBytes: true,
+ EncodeUnionsAsXUnionBytes: true,
+ },
+ input: &v1,
+ bytes: []byte{
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xfe, 0xe0, 0x99, 0x74, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xfe, 0xe0, 0x99, 0x74, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ },
+ }.check(t)
+ }
+
+ {
v1 := conformance.StructWithArrays{}
var v2 int32 = 1
var v3 int32 = 2
@@ -878,7 +983,7 @@
v1.ArrArrInt = v29
encodeSuccessCase{
- name: "Arrays",
+ name: "Arrays_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -947,7 +1052,7 @@
v1.VecVecInt = v27
encodeSuccessCase{
- name: "Vectors",
+ name: "Vectors_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1003,7 +1108,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "BoolTrue",
+ name: "BoolTrue_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1021,7 +1126,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "BoolFalse",
+ name: "BoolFalse_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1039,7 +1144,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "ByteZero",
+ name: "ByteZero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1057,7 +1162,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Byte255",
+ name: "Byte255_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1075,7 +1180,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Int8Min",
+ name: "Int8Min_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1093,7 +1198,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Int8Zero",
+ name: "Int8Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1111,7 +1216,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Int8Max",
+ name: "Int8Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1129,7 +1234,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Int16Min",
+ name: "Int16Min_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1147,7 +1252,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Int16Zero",
+ name: "Int16Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1165,7 +1270,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Int16Max",
+ name: "Int16Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1183,7 +1288,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Int32Min",
+ name: "Int32Min_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1201,7 +1306,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Int32Zero",
+ name: "Int32Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1219,7 +1324,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Int32Max",
+ name: "Int32Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1237,7 +1342,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Int64Min",
+ name: "Int64Min_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1255,7 +1360,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Int64Zero",
+ name: "Int64Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1273,7 +1378,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Int64Max",
+ name: "Int64Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1291,7 +1396,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Uint8Zero",
+ name: "Uint8Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1309,7 +1414,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Uint8Max",
+ name: "Uint8Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1327,7 +1432,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Uint16Zero",
+ name: "Uint16Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1345,7 +1450,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Uint16Max",
+ name: "Uint16Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1363,7 +1468,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Uint32Zero",
+ name: "Uint32Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1381,7 +1486,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Uint32Max",
+ name: "Uint32Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1399,7 +1504,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Uint64Zero",
+ name: "Uint64Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1417,7 +1522,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Uint64Max",
+ name: "Uint64Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1435,7 +1540,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Float32Zero",
+ name: "Float32Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1453,7 +1558,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Float32One",
+ name: "Float32One_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1471,7 +1576,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Float32MinusOne",
+ name: "Float32MinusOne_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1489,7 +1594,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Float32Max",
+ name: "Float32Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1507,7 +1612,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Float64Zero",
+ name: "Float64Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1525,7 +1630,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Float64One",
+ name: "Float64One_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1543,7 +1648,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Float64MinusOne",
+ name: "Float64MinusOne_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1561,7 +1666,7 @@
v1.Value = v2
encodeSuccessCase{
- name: "Float64Max",
+ name: "Float64Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1585,7 +1690,7 @@
v1.After = v5
encodeSuccessCase{
- name: "Sandwich1Case1",
+ name: "Sandwich1Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1639,7 +1744,7 @@
v1.After = v5
encodeSuccessCase{
- name: "Sandwich1WithOptUnionPresent",
+ name: "Sandwich1WithOptUnionPresent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1691,7 +1796,7 @@
v1.After = v3
encodeSuccessCase{
- name: "Sandwich1WithOptUnionAbsent",
+ name: "Sandwich1WithOptUnionAbsent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1747,7 +1852,7 @@
v1.After = v11
encodeSuccessCase{
- name: "Sandwich2Case1",
+ name: "Sandwich2Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1812,7 +1917,7 @@
v1.After = v7
encodeSuccessCase{
- name: "Sandwich3Case1",
+ name: "Sandwich3Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -1906,7 +2011,7 @@
v1.After = v37
encodeSuccessCase{
- name: "Sandwich4Case1",
+ name: "Sandwich4Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -2001,7 +2106,7 @@
v1.After = v6
encodeSuccessCase{
- name: "Sandwich5Case1",
+ name: "Sandwich5Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -2070,7 +2175,7 @@
v1.After = v8
encodeSuccessCase{
- name: "Sandwich5Case2",
+ name: "Sandwich5Case2_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -2144,7 +2249,7 @@
v1.After = v11
encodeSuccessCase{
- name: "Sandwich6Case1",
+ name: "Sandwich6Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -2210,7 +2315,7 @@
v1.After = v5
encodeSuccessCase{
- name: "Sandwich6Case1AbsentVector",
+ name: "Sandwich6Case1AbsentVector_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -2268,7 +2373,7 @@
v1.After = v5
encodeSuccessCase{
- name: "Sandwich6Case2",
+ name: "Sandwich6Case2_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -2350,7 +2455,7 @@
v1.After = v20
encodeSuccessCase{
- name: "Sandwich6Case3",
+ name: "Sandwich6Case3_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -2445,7 +2550,7 @@
v1.After = v14
encodeSuccessCase{
- name: "Sandwich6Case4",
+ name: "Sandwich6Case4_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -2525,7 +2630,7 @@
v1.After = v8
encodeSuccessCase{
- name: "Sandwich6Case5",
+ name: "Sandwich6Case5_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -2602,7 +2707,7 @@
v1.After = v15
encodeSuccessCase{
- name: "Sandwich6Case6",
+ name: "Sandwich6Case6_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -2681,7 +2786,7 @@
v1.After = v11
encodeSuccessCase{
- name: "Sandwich6Case7",
+ name: "Sandwich6Case7_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -2751,7 +2856,7 @@
v1.After = v7
encodeSuccessCase{
- name: "Sandwich6Case8",
+ name: "Sandwich6Case8_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -2823,7 +2928,7 @@
v1.After = v8
encodeSuccessCase{
- name: "Sandwich7Case1",
+ name: "Sandwich7Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -2885,7 +2990,7 @@
v1.After = v3
encodeSuccessCase{
- name: "Sandwich7Case2",
+ name: "Sandwich7Case2_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -2937,7 +3042,7 @@
v1.F6 = v7
encodeSuccessCase{
- name: "Regression1",
+ name: "Regression1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -3003,7 +3108,7 @@
v1.F7 = v9
encodeSuccessCase{
- name: "Regression2",
+ name: "Regression2_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -3059,7 +3164,7 @@
v1 := conformance.Regression3{}
encodeSuccessCase{
- name: "Regression3Absent",
+ name: "Regression3Absent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -3109,7 +3214,7 @@
v1.OptValue = v2
encodeSuccessCase{
- name: "Regression3Present",
+ name: "Regression3Present_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -3195,7 +3300,7 @@
v1.A = v23
encodeSuccessCase{
- name: "Size5Alignment1Array",
+ name: "Size5Alignment1Array_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -3272,7 +3377,7 @@
v1.A = v11
encodeSuccessCase{
- name: "Size5Alignment4Array",
+ name: "Size5Alignment4Array_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -3343,7 +3448,7 @@
v1.V = v16
encodeSuccessCase{
- name: "Size5Alignment1Vector",
+ name: "Size5Alignment1Vector_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -3411,7 +3516,7 @@
v1.V = v8
encodeSuccessCase{
- name: "Size5Alignment4Vector",
+ name: "Size5Alignment4Vector_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -3477,7 +3582,7 @@
v1.Table = v2
encodeSuccessCase{
- name: "Table_StructWithReservedSandwich",
+ name: "Table_StructWithReservedSandwich_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -3563,7 +3668,7 @@
v1.Table = v2
encodeSuccessCase{
- name: "Table_StructWithUint32Sandwich",
+ name: "Table_StructWithUint32Sandwich_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -3647,7 +3752,7 @@
v1.Table = v2
encodeSuccessCase{
- name: "Table_UnionWithVector_ReservedSandwich",
+ name: "Table_UnionWithVector_ReservedSandwich_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -3725,7 +3830,7 @@
v1.Table = v2
encodeSuccessCase{
- name: "Table_UnionWithVector_StructSandwich",
+ name: "Table_UnionWithVector_StructSandwich_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -3814,7 +3919,7 @@
v1.Xu = v2
encodeSuccessCase{
- name: "XUnionWithStruct",
+ name: "XUnionWithStruct_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -3883,7 +3988,7 @@
v1.OptionalUnions = v15
encodeSuccessCase{
- name: "ArrayStruct",
+ name: "ArrayStruct_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -3998,7 +4103,7 @@
v1 := conformance.TransformerEmptyStruct{}
encodeSuccessCase{
- name: "TransformerEmptyStruct",
+ name: "TransformerEmptyStruct_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -4034,7 +4139,7 @@
v1.U = v2
encodeSuccessCase{
- name: "EmptyStructUnion",
+ name: "EmptyStructUnion_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -4207,7 +4312,7 @@
v1.F9 = v116
encodeSuccessCase{
- name: "NoCodingTablesStressor",
+ name: "NoCodingTablesStressor_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -4448,7 +4553,7 @@
v1.After = v9
encodeSuccessCase{
- name: "OutOfLineSandwich1Case1",
+ name: "OutOfLineSandwich1Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -4540,7 +4645,7 @@
v1.After = v9
encodeSuccessCase{
- name: "OutOfLineSandwich1WithOptUnionPresent",
+ name: "OutOfLineSandwich1WithOptUnionPresent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -4630,7 +4735,7 @@
v1.After = v7
encodeSuccessCase{
- name: "OutOfLineSandwich1WithOptUnionAbsent",
+ name: "OutOfLineSandwich1WithOptUnionAbsent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -4722,7 +4827,7 @@
v1.F6 = v12
encodeSuccessCase{
- name: "Regression4",
+ name: "Regression4_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -4823,7 +4928,7 @@
v1.Alignment8Enforcement = v39
encodeSuccessCase{
- name: "Sandwich4Align8",
+ name: "Sandwich4Align8_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -4960,7 +5065,7 @@
v1.Alignment8Enforcement = v39
encodeSuccessCase{
- name: "Sandwich4Align8WithPointer",
+ name: "Sandwich4Align8WithPointer_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5065,7 +5170,7 @@
v1.After = v6
encodeSuccessCase{
- name: "Sandwich8Case1",
+ name: "Sandwich8Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5141,7 +5246,7 @@
v1.After = v16
encodeSuccessCase{
- name: "Sandwich9Case1",
+ name: "Sandwich9Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5224,7 +5329,7 @@
v1.TheArray = v6
encodeSuccessCase{
- name: "SimpleTableArrayStruct",
+ name: "SimpleTableArrayStruct_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5293,7 +5398,7 @@
v1.TheVector = v8
encodeSuccessCase{
- name: "StringUnionVector",
+ name: "StringUnionVector_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5362,6 +5467,106 @@
}
{
+ v1 := conformance.CreateComponentRequest{}
+ v2 := conformance.LaunchInfo{}
+ v3 := "fuchsia-pkg://fuchsia.com/fidl_compatibility_test_server_rust_write_xunion#meta/fidl_compatibility_test_server_rust_write_xunion.cmx"
+ v2.Url = v3
+ var v4 uint32 = 4294967295
+ v2.DirectoryRequest = v4
+ v1.LaunchInfo = v2
+ var v5 uint32 = 4294967295
+ v1.Controller = v5
+
+ encodeSuccessCase{
+ name: "CreateComponentRequest_old",
+ context: fidl.MarshalerContext{
+ DecodeUnionsFromXUnionBytes: false,
+ EncodeUnionsAsXUnionBytes: false,
+ },
+ input: &v1,
+ bytes: []byte{
+ 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x66, 0x75, 0x63, 0x68, 0x73, 0x69, 0x61, 0x2d,
+ 0x70, 0x6b, 0x67, 0x3a, 0x2f, 0x2f, 0x66, 0x75,
+ 0x63, 0x68, 0x73, 0x69, 0x61, 0x2e, 0x63, 0x6f,
+ 0x6d, 0x2f, 0x66, 0x69, 0x64, 0x6c, 0x5f, 0x63,
+ 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69, 0x62, 0x69,
+ 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x74, 0x65, 0x73,
+ 0x74, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
+ 0x5f, 0x72, 0x75, 0x73, 0x74, 0x5f, 0x77, 0x72,
+ 0x69, 0x74, 0x65, 0x5f, 0x78, 0x75, 0x6e, 0x69,
+ 0x6f, 0x6e, 0x23, 0x6d, 0x65, 0x74, 0x61, 0x2f,
+ 0x66, 0x69, 0x64, 0x6c, 0x5f, 0x63, 0x6f, 0x6d,
+ 0x70, 0x61, 0x74, 0x69, 0x62, 0x69, 0x6c, 0x69,
+ 0x74, 0x79, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f,
+ 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x72,
+ 0x75, 0x73, 0x74, 0x5f, 0x77, 0x72, 0x69, 0x74,
+ 0x65, 0x5f, 0x78, 0x75, 0x6e, 0x69, 0x6f, 0x6e,
+ 0x2e, 0x63, 0x6d, 0x78, 0x00, 0x00, 0x00, 0x00,
+ },
+ }.check(t)
+ }
+
+ {
+ v1 := conformance.CreateComponentRequest{}
+ v2 := conformance.LaunchInfo{}
+ v3 := "fuchsia-pkg://fuchsia.com/fidl_compatibility_test_server_rust_write_xunion#meta/fidl_compatibility_test_server_rust_write_xunion.cmx"
+ v2.Url = v3
+ var v4 uint32 = 4294967295
+ v2.DirectoryRequest = v4
+ v1.LaunchInfo = v2
+ var v5 uint32 = 4294967295
+ v1.Controller = v5
+
+ encodeSuccessCase{
+ name: "CreateComponentRequest_v1",
+ context: fidl.MarshalerContext{
+ DecodeUnionsFromXUnionBytes: true,
+ EncodeUnionsAsXUnionBytes: true,
+ },
+ input: &v1,
+ bytes: []byte{
+ 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x66, 0x75, 0x63, 0x68, 0x73, 0x69, 0x61, 0x2d,
+ 0x70, 0x6b, 0x67, 0x3a, 0x2f, 0x2f, 0x66, 0x75,
+ 0x63, 0x68, 0x73, 0x69, 0x61, 0x2e, 0x63, 0x6f,
+ 0x6d, 0x2f, 0x66, 0x69, 0x64, 0x6c, 0x5f, 0x63,
+ 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69, 0x62, 0x69,
+ 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x74, 0x65, 0x73,
+ 0x74, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
+ 0x5f, 0x72, 0x75, 0x73, 0x74, 0x5f, 0x77, 0x72,
+ 0x69, 0x74, 0x65, 0x5f, 0x78, 0x75, 0x6e, 0x69,
+ 0x6f, 0x6e, 0x23, 0x6d, 0x65, 0x74, 0x61, 0x2f,
+ 0x66, 0x69, 0x64, 0x6c, 0x5f, 0x63, 0x6f, 0x6d,
+ 0x70, 0x61, 0x74, 0x69, 0x62, 0x69, 0x6c, 0x69,
+ 0x74, 0x79, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f,
+ 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x72,
+ 0x75, 0x73, 0x74, 0x5f, 0x77, 0x72, 0x69, 0x74,
+ 0x65, 0x5f, 0x78, 0x75, 0x6e, 0x69, 0x6f, 0x6e,
+ 0x2e, 0x63, 0x6d, 0x78, 0x00, 0x00, 0x00, 0x00,
+ },
+ }.check(t)
+ }
+
+ {
v1 := conformance.UnionWithBoundStringStruct{}
v2 := conformance.UnionWithBoundString{}
v3 := "abcd"
@@ -5369,7 +5574,7 @@
v1.V = v2
encodeSuccessCase{
- name: "UnionWithBoundString",
+ name: "UnionWithBoundString_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5385,6 +5590,31 @@
}
{
+ v1 := conformance.UnionWithBoundStringStruct{}
+ v2 := conformance.UnionWithBoundString{}
+ v3 := "abcd"
+ v2.SetBoundFiveStr(v3)
+ v1.V = v2
+
+ encodeSuccessCase{
+ name: "UnionWithBoundString_v1",
+ context: fidl.MarshalerContext{
+ DecodeUnionsFromXUnionBytes: true,
+ EncodeUnionsAsXUnionBytes: true,
+ },
+ input: &v1,
+ bytes: []byte{
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x61, 0x62, 0x63, 0x64, 0x00, 0x00, 0x00, 0x00,
+ },
+ }.check(t)
+ }
+
+ {
v1 := conformance.SingleVariantUnionStruct{}
v2 := conformance.SingleVariantUnion{}
var v3 uint32 = 42
@@ -5392,7 +5622,7 @@
v1.U = v2
encodeSuccessCase{
- name: "UnionMigration_SingleVariant",
+ name: "UnionMigration_SingleVariant_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5427,6 +5657,50 @@
}.check(t)
}
+ {
+ v1 := conformance.ReverseOrdinalUnionStruct{}
+ v2 := conformance.ReverseOrdinalUnion{}
+ var v3 int64 = 42
+ v2.SetX(v3)
+ v1.U = v2
+
+ encodeSuccessCase{
+ name: "ReverseOrdinalUnion_old",
+ context: fidl.MarshalerContext{
+ DecodeUnionsFromXUnionBytes: false,
+ EncodeUnionsAsXUnionBytes: false,
+ },
+ input: &v1,
+ bytes: []byte{
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ },
+ }.check(t)
+ }
+
+ {
+ v1 := conformance.ReverseOrdinalUnionStruct{}
+ v2 := conformance.ReverseOrdinalUnion{}
+ var v3 int64 = 42
+ v2.SetX(v3)
+ v1.U = v2
+
+ encodeSuccessCase{
+ name: "ReverseOrdinalUnion_v1",
+ context: fidl.MarshalerContext{
+ DecodeUnionsFromXUnionBytes: true,
+ EncodeUnionsAsXUnionBytes: true,
+ },
+ input: &v1,
+ bytes: []byte{
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ },
+ }.check(t)
+ }
+
}
func TestAllDecodeSuccessCases(t *testing.T) {
@@ -5459,7 +5733,7 @@
v1.Elem3 = v10
decodeSuccessCase{
- name: "3ByteObjectAlignmentInStruct",
+ name: "3ByteObjectAlignmentInStruct_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5494,7 +5768,7 @@
v1.Elem3 = v8
decodeSuccessCase{
- name: "5ByteObjectAlignmentInStruct",
+ name: "5ByteObjectAlignmentInStruct_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5535,7 +5809,7 @@
v1.Elems = v14
decodeSuccessCase{
- name: "3ByteObjectAlignmentInVector",
+ name: "3ByteObjectAlignmentInVector_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5571,7 +5845,7 @@
v1.Elems = v11
decodeSuccessCase{
- name: "5ByteObjectAlignmentInVector",
+ name: "5ByteObjectAlignmentInVector_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5614,7 +5888,7 @@
v1.Elems = v14
decodeSuccessCase{
- name: "3ByteObjectAlignmentInArray",
+ name: "3ByteObjectAlignmentInArray_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5648,7 +5922,7 @@
v1.Elems = v11
decodeSuccessCase{
- name: "5ByteObjectAlignmentInArray",
+ name: "5ByteObjectAlignmentInArray_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5666,7 +5940,7 @@
v1 := conformance.EmptyStruct{}
decodeSuccessCase{
- name: "EmptyStruct",
+ name: "EmptyStruct_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5688,7 +5962,7 @@
v1.After = v4
decodeSuccessCase{
- name: "EmptyStructSandwich",
+ name: "EmptyStructSandwich_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5718,7 +5992,7 @@
v1.F4 = v5
decodeSuccessCase{
- name: "Uint8Uint16Uint32Uint64",
+ name: "Uint8Uint16Uint32Uint64_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5743,7 +6017,7 @@
v1.F4 = v5
decodeSuccessCase{
- name: "Uint64Uint32Uint16Uint8",
+ name: "Uint64Uint32Uint16Uint8_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5762,7 +6036,7 @@
v1.Table = v2
decodeSuccessCase{
- name: "SimpleTableEmpty",
+ name: "SimpleTableEmpty_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5785,7 +6059,7 @@
v1.Table = v2
decodeSuccessCase{
- name: "SimpleTableXAndY",
+ name: "SimpleTableXAndY_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5818,7 +6092,7 @@
v1.Table = v2
decodeSuccessCase{
- name: "SimpleTableJustY",
+ name: "SimpleTableJustY_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5852,7 +6126,7 @@
v1.Table = v2
decodeSuccessCase{
- name: "TableWithStringAndVectorNoVectorContent",
+ name: "TableWithStringAndVectorNoVectorContent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5885,7 +6159,7 @@
v1.Number = v5
decodeSuccessCase{
- name: "SimpleTableThenUint64",
+ name: "SimpleTableThenUint64_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5923,7 +6197,7 @@
v1.After = v5
decodeSuccessCase{
- name: "InlineXUnionInStruct",
+ name: "InlineXUnionInStruct_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5952,7 +6226,7 @@
v1.After = v3
decodeSuccessCase{
- name: "OptionalXUnionInStructAbsent",
+ name: "OptionalXUnionInStructAbsent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -5984,7 +6258,7 @@
v1.After = v5
decodeSuccessCase{
- name: "OptionalXUnionInStructPresent",
+ name: "OptionalXUnionInStructPresent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6015,7 +6289,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "XUnionInTableXUnionAbsent",
+ name: "XUnionInTableXUnionAbsent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6054,7 +6328,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "XUnionInTableXUnionPresent",
+ name: "XUnionInTableXUnionPresent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6091,7 +6365,7 @@
v1.Xu = v2
decodeSuccessCase{
- name: "StrictXUnion",
+ name: "StrictXUnion_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6122,7 +6396,7 @@
v1.ThisShouldBeAHandle = v7
decodeSuccessCase{
- name: "AddEthernetDeviceRequest",
+ name: "AddEthernetDeviceRequest_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6149,6 +6423,48 @@
}
{
+ v1 := conformance.TestAddEthernetDeviceRequest{}
+ v2 := "@/dev/sys/pci/00:03.0/e1000/ethernet"
+ v1.TopologicalPath = v2
+ v3 := conformance.InterfaceConfig{}
+ v4 := "ethp0003"
+ v3.Name = v4
+ v5 := conformance.IpAddressConfig{}
+ v6 := true
+ v5.SetDhcp(v6)
+ v3.IpAddressConfig = v5
+ v1.Config = v3
+ var v7 uint32 = 4294967295
+ v1.ThisShouldBeAHandle = v7
+
+ decodeSuccessCase{
+ name: "AddEthernetDeviceRequest_v1",
+ context: fidl.MarshalerContext{
+ DecodeUnionsFromXUnionBytes: true,
+ EncodeUnionsAsXUnionBytes: true,
+ },
+ input: &v1,
+ bytes: []byte{
+ 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x40, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x79,
+ 0x73, 0x2f, 0x70, 0x63, 0x69, 0x2f, 0x30, 0x30,
+ 0x3a, 0x30, 0x33, 0x2e, 0x30, 0x2f, 0x65, 0x31,
+ 0x30, 0x30, 0x30, 0x2f, 0x65, 0x74, 0x68, 0x65,
+ 0x72, 0x6e, 0x65, 0x74, 0x00, 0x00, 0x00, 0x00,
+ 0x65, 0x74, 0x68, 0x70, 0x30, 0x30, 0x30, 0x33,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ },
+ }.check(t)
+ }
+
+ {
v1 := conformance.FileGetAttrResponse{}
var v2 int32 = 2125315759
v1.S = v2
@@ -6170,7 +6486,7 @@
v1.Attributes = v3
decodeSuccessCase{
- name: "FileGetAttrResponse",
+ name: "FileGetAttrResponse_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6217,7 +6533,7 @@
v1.U2 = v12
decodeSuccessCase{
- name: "Optionals",
+ name: "Optionals_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6250,6 +6566,69 @@
}
{
+ v1 := conformance.StructWithOptionals{}
+ v2 := conformance.EmptyStruct{}
+ v1.S = v2
+ v3 := &conformance.EmptyStruct{}
+ v1.S2 = v3
+ v4 := conformance.TableWithEmptyStruct{}
+ v5 := conformance.EmptyStruct{}
+ v4.SetS(v5)
+ v1.T = v4
+ v6 := conformance.XUnionWithEmptyStruct{}
+ v7 := conformance.EmptyStruct{}
+ v6.SetS(v7)
+ v1.Xu = v6
+ v8 := &conformance.XUnionWithEmptyStruct{}
+ v9 := conformance.EmptyStruct{}
+ v8.SetS(v9)
+ v1.Xu2 = v8
+ v10 := conformance.UnionWithEmptyStruct{}
+ v11 := conformance.EmptyStruct{}
+ v10.SetS(v11)
+ v1.U = v10
+ v12 := &conformance.UnionWithEmptyStruct{}
+ v13 := conformance.EmptyStruct{}
+ v12.SetS(v13)
+ v1.U2 = v12
+
+ decodeSuccessCase{
+ name: "Optionals_v1",
+ context: fidl.MarshalerContext{
+ DecodeUnionsFromXUnionBytes: true,
+ EncodeUnionsAsXUnionBytes: true,
+ },
+ input: &v1,
+ bytes: []byte{
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xfe, 0xe0, 0x99, 0x74, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xfe, 0xe0, 0x99, 0x74, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ },
+ }.check(t)
+ }
+
+ {
v1 := conformance.StructWithArrays{}
var v2 int32 = 1
var v3 int32 = 2
@@ -6290,7 +6669,7 @@
v1.ArrArrInt = v29
decodeSuccessCase{
- name: "Arrays",
+ name: "Arrays_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6359,7 +6738,7 @@
v1.VecVecInt = v27
decodeSuccessCase{
- name: "Vectors",
+ name: "Vectors_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6415,7 +6794,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "BoolTrue",
+ name: "BoolTrue_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6433,7 +6812,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "BoolFalse",
+ name: "BoolFalse_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6451,7 +6830,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "ByteZero",
+ name: "ByteZero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6469,7 +6848,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Byte255",
+ name: "Byte255_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6487,7 +6866,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Int8Min",
+ name: "Int8Min_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6505,7 +6884,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Int8Zero",
+ name: "Int8Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6523,7 +6902,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Int8Max",
+ name: "Int8Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6541,7 +6920,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Int16Min",
+ name: "Int16Min_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6559,7 +6938,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Int16Zero",
+ name: "Int16Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6577,7 +6956,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Int16Max",
+ name: "Int16Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6595,7 +6974,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Int32Min",
+ name: "Int32Min_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6613,7 +6992,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Int32Zero",
+ name: "Int32Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6631,7 +7010,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Int32Max",
+ name: "Int32Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6649,7 +7028,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Int64Min",
+ name: "Int64Min_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6667,7 +7046,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Int64Zero",
+ name: "Int64Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6685,7 +7064,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Int64Max",
+ name: "Int64Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6703,7 +7082,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Uint8Zero",
+ name: "Uint8Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6721,7 +7100,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Uint8Max",
+ name: "Uint8Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6739,7 +7118,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Uint16Zero",
+ name: "Uint16Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6757,7 +7136,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Uint16Max",
+ name: "Uint16Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6775,7 +7154,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Uint32Zero",
+ name: "Uint32Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6793,7 +7172,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Uint32Max",
+ name: "Uint32Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6811,7 +7190,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Uint64Zero",
+ name: "Uint64Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6829,7 +7208,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Uint64Max",
+ name: "Uint64Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6847,7 +7226,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Float32Zero",
+ name: "Float32Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6865,7 +7244,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Float32One",
+ name: "Float32One_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6883,7 +7262,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Float32MinusOne",
+ name: "Float32MinusOne_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6901,7 +7280,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Float32Max",
+ name: "Float32Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6919,7 +7298,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Float64Zero",
+ name: "Float64Zero_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6937,7 +7316,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Float64One",
+ name: "Float64One_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6955,7 +7334,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Float64MinusOne",
+ name: "Float64MinusOne_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6973,7 +7352,7 @@
v1.Value = v2
decodeSuccessCase{
- name: "Float64Max",
+ name: "Float64Max_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -6997,7 +7376,7 @@
v1.After = v5
decodeSuccessCase{
- name: "Sandwich1Case1",
+ name: "Sandwich1Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -7051,7 +7430,7 @@
v1.After = v5
decodeSuccessCase{
- name: "Sandwich1WithOptUnionPresent",
+ name: "Sandwich1WithOptUnionPresent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -7103,7 +7482,7 @@
v1.After = v3
decodeSuccessCase{
- name: "Sandwich1WithOptUnionAbsent",
+ name: "Sandwich1WithOptUnionAbsent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -7159,7 +7538,7 @@
v1.After = v11
decodeSuccessCase{
- name: "Sandwich2Case1",
+ name: "Sandwich2Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -7224,7 +7603,7 @@
v1.After = v7
decodeSuccessCase{
- name: "Sandwich3Case1",
+ name: "Sandwich3Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -7318,7 +7697,7 @@
v1.After = v37
decodeSuccessCase{
- name: "Sandwich4Case1",
+ name: "Sandwich4Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -7413,7 +7792,7 @@
v1.After = v6
decodeSuccessCase{
- name: "Sandwich5Case1",
+ name: "Sandwich5Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -7482,7 +7861,7 @@
v1.After = v8
decodeSuccessCase{
- name: "Sandwich5Case2",
+ name: "Sandwich5Case2_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -7556,7 +7935,7 @@
v1.After = v11
decodeSuccessCase{
- name: "Sandwich6Case1",
+ name: "Sandwich6Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -7622,7 +8001,7 @@
v1.After = v5
decodeSuccessCase{
- name: "Sandwich6Case1AbsentVector",
+ name: "Sandwich6Case1AbsentVector_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -7680,7 +8059,7 @@
v1.After = v5
decodeSuccessCase{
- name: "Sandwich6Case2",
+ name: "Sandwich6Case2_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -7762,7 +8141,7 @@
v1.After = v20
decodeSuccessCase{
- name: "Sandwich6Case3",
+ name: "Sandwich6Case3_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -7857,7 +8236,7 @@
v1.After = v14
decodeSuccessCase{
- name: "Sandwich6Case4",
+ name: "Sandwich6Case4_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -7937,7 +8316,7 @@
v1.After = v8
decodeSuccessCase{
- name: "Sandwich6Case5",
+ name: "Sandwich6Case5_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -8014,7 +8393,7 @@
v1.After = v15
decodeSuccessCase{
- name: "Sandwich6Case6",
+ name: "Sandwich6Case6_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -8093,7 +8472,7 @@
v1.After = v11
decodeSuccessCase{
- name: "Sandwich6Case7",
+ name: "Sandwich6Case7_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -8163,7 +8542,7 @@
v1.After = v7
decodeSuccessCase{
- name: "Sandwich6Case8",
+ name: "Sandwich6Case8_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -8235,7 +8614,7 @@
v1.After = v8
decodeSuccessCase{
- name: "Sandwich7Case1",
+ name: "Sandwich7Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -8297,7 +8676,7 @@
v1.After = v3
decodeSuccessCase{
- name: "Sandwich7Case2",
+ name: "Sandwich7Case2_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -8349,7 +8728,7 @@
v1.F6 = v7
decodeSuccessCase{
- name: "Regression1",
+ name: "Regression1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -8415,7 +8794,7 @@
v1.F7 = v9
decodeSuccessCase{
- name: "Regression2",
+ name: "Regression2_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -8471,7 +8850,7 @@
v1 := conformance.Regression3{}
decodeSuccessCase{
- name: "Regression3Absent",
+ name: "Regression3Absent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -8521,7 +8900,7 @@
v1.OptValue = v2
decodeSuccessCase{
- name: "Regression3Present",
+ name: "Regression3Present_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -8607,7 +8986,7 @@
v1.A = v23
decodeSuccessCase{
- name: "Size5Alignment1Array",
+ name: "Size5Alignment1Array_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -8684,7 +9063,7 @@
v1.A = v11
decodeSuccessCase{
- name: "Size5Alignment4Array",
+ name: "Size5Alignment4Array_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -8755,7 +9134,7 @@
v1.V = v16
decodeSuccessCase{
- name: "Size5Alignment1Vector",
+ name: "Size5Alignment1Vector_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -8823,7 +9202,7 @@
v1.V = v8
decodeSuccessCase{
- name: "Size5Alignment4Vector",
+ name: "Size5Alignment4Vector_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -8889,7 +9268,7 @@
v1.Table = v2
decodeSuccessCase{
- name: "Table_StructWithReservedSandwich",
+ name: "Table_StructWithReservedSandwich_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -8975,7 +9354,7 @@
v1.Table = v2
decodeSuccessCase{
- name: "Table_StructWithUint32Sandwich",
+ name: "Table_StructWithUint32Sandwich_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -9059,7 +9438,7 @@
v1.Table = v2
decodeSuccessCase{
- name: "Table_UnionWithVector_ReservedSandwich",
+ name: "Table_UnionWithVector_ReservedSandwich_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -9137,7 +9516,7 @@
v1.Table = v2
decodeSuccessCase{
- name: "Table_UnionWithVector_StructSandwich",
+ name: "Table_UnionWithVector_StructSandwich_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -9226,7 +9605,7 @@
v1.Xu = v2
decodeSuccessCase{
- name: "XUnionWithStruct",
+ name: "XUnionWithStruct_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -9295,7 +9674,7 @@
v1.OptionalUnions = v15
decodeSuccessCase{
- name: "ArrayStruct",
+ name: "ArrayStruct_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -9410,7 +9789,7 @@
v1 := conformance.TransformerEmptyStruct{}
decodeSuccessCase{
- name: "TransformerEmptyStruct",
+ name: "TransformerEmptyStruct_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -9446,7 +9825,7 @@
v1.U = v2
decodeSuccessCase{
- name: "EmptyStructUnion",
+ name: "EmptyStructUnion_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -9619,7 +9998,7 @@
v1.F9 = v116
decodeSuccessCase{
- name: "NoCodingTablesStressor",
+ name: "NoCodingTablesStressor_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -9860,7 +10239,7 @@
v1.After = v9
decodeSuccessCase{
- name: "OutOfLineSandwich1Case1",
+ name: "OutOfLineSandwich1Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -9952,7 +10331,7 @@
v1.After = v9
decodeSuccessCase{
- name: "OutOfLineSandwich1WithOptUnionPresent",
+ name: "OutOfLineSandwich1WithOptUnionPresent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -10042,7 +10421,7 @@
v1.After = v7
decodeSuccessCase{
- name: "OutOfLineSandwich1WithOptUnionAbsent",
+ name: "OutOfLineSandwich1WithOptUnionAbsent_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -10134,7 +10513,7 @@
v1.F6 = v12
decodeSuccessCase{
- name: "Regression4",
+ name: "Regression4_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -10235,7 +10614,7 @@
v1.Alignment8Enforcement = v39
decodeSuccessCase{
- name: "Sandwich4Align8",
+ name: "Sandwich4Align8_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -10372,7 +10751,7 @@
v1.Alignment8Enforcement = v39
decodeSuccessCase{
- name: "Sandwich4Align8WithPointer",
+ name: "Sandwich4Align8WithPointer_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -10477,7 +10856,7 @@
v1.After = v6
decodeSuccessCase{
- name: "Sandwich8Case1",
+ name: "Sandwich8Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -10553,7 +10932,7 @@
v1.After = v16
decodeSuccessCase{
- name: "Sandwich9Case1",
+ name: "Sandwich9Case1_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -10636,7 +11015,7 @@
v1.TheArray = v6
decodeSuccessCase{
- name: "SimpleTableArrayStruct",
+ name: "SimpleTableArrayStruct_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -10705,7 +11084,7 @@
v1.TheVector = v8
decodeSuccessCase{
- name: "StringUnionVector",
+ name: "StringUnionVector_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -10774,6 +11153,106 @@
}
{
+ v1 := conformance.CreateComponentRequest{}
+ v2 := conformance.LaunchInfo{}
+ v3 := "fuchsia-pkg://fuchsia.com/fidl_compatibility_test_server_rust_write_xunion#meta/fidl_compatibility_test_server_rust_write_xunion.cmx"
+ v2.Url = v3
+ var v4 uint32 = 4294967295
+ v2.DirectoryRequest = v4
+ v1.LaunchInfo = v2
+ var v5 uint32 = 4294967295
+ v1.Controller = v5
+
+ decodeSuccessCase{
+ name: "CreateComponentRequest_old",
+ context: fidl.MarshalerContext{
+ DecodeUnionsFromXUnionBytes: false,
+ EncodeUnionsAsXUnionBytes: false,
+ },
+ input: &v1,
+ bytes: []byte{
+ 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x66, 0x75, 0x63, 0x68, 0x73, 0x69, 0x61, 0x2d,
+ 0x70, 0x6b, 0x67, 0x3a, 0x2f, 0x2f, 0x66, 0x75,
+ 0x63, 0x68, 0x73, 0x69, 0x61, 0x2e, 0x63, 0x6f,
+ 0x6d, 0x2f, 0x66, 0x69, 0x64, 0x6c, 0x5f, 0x63,
+ 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69, 0x62, 0x69,
+ 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x74, 0x65, 0x73,
+ 0x74, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
+ 0x5f, 0x72, 0x75, 0x73, 0x74, 0x5f, 0x77, 0x72,
+ 0x69, 0x74, 0x65, 0x5f, 0x78, 0x75, 0x6e, 0x69,
+ 0x6f, 0x6e, 0x23, 0x6d, 0x65, 0x74, 0x61, 0x2f,
+ 0x66, 0x69, 0x64, 0x6c, 0x5f, 0x63, 0x6f, 0x6d,
+ 0x70, 0x61, 0x74, 0x69, 0x62, 0x69, 0x6c, 0x69,
+ 0x74, 0x79, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f,
+ 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x72,
+ 0x75, 0x73, 0x74, 0x5f, 0x77, 0x72, 0x69, 0x74,
+ 0x65, 0x5f, 0x78, 0x75, 0x6e, 0x69, 0x6f, 0x6e,
+ 0x2e, 0x63, 0x6d, 0x78, 0x00, 0x00, 0x00, 0x00,
+ },
+ }.check(t)
+ }
+
+ {
+ v1 := conformance.CreateComponentRequest{}
+ v2 := conformance.LaunchInfo{}
+ v3 := "fuchsia-pkg://fuchsia.com/fidl_compatibility_test_server_rust_write_xunion#meta/fidl_compatibility_test_server_rust_write_xunion.cmx"
+ v2.Url = v3
+ var v4 uint32 = 4294967295
+ v2.DirectoryRequest = v4
+ v1.LaunchInfo = v2
+ var v5 uint32 = 4294967295
+ v1.Controller = v5
+
+ decodeSuccessCase{
+ name: "CreateComponentRequest_v1",
+ context: fidl.MarshalerContext{
+ DecodeUnionsFromXUnionBytes: true,
+ EncodeUnionsAsXUnionBytes: true,
+ },
+ input: &v1,
+ bytes: []byte{
+ 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x66, 0x75, 0x63, 0x68, 0x73, 0x69, 0x61, 0x2d,
+ 0x70, 0x6b, 0x67, 0x3a, 0x2f, 0x2f, 0x66, 0x75,
+ 0x63, 0x68, 0x73, 0x69, 0x61, 0x2e, 0x63, 0x6f,
+ 0x6d, 0x2f, 0x66, 0x69, 0x64, 0x6c, 0x5f, 0x63,
+ 0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69, 0x62, 0x69,
+ 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x74, 0x65, 0x73,
+ 0x74, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
+ 0x5f, 0x72, 0x75, 0x73, 0x74, 0x5f, 0x77, 0x72,
+ 0x69, 0x74, 0x65, 0x5f, 0x78, 0x75, 0x6e, 0x69,
+ 0x6f, 0x6e, 0x23, 0x6d, 0x65, 0x74, 0x61, 0x2f,
+ 0x66, 0x69, 0x64, 0x6c, 0x5f, 0x63, 0x6f, 0x6d,
+ 0x70, 0x61, 0x74, 0x69, 0x62, 0x69, 0x6c, 0x69,
+ 0x74, 0x79, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x5f,
+ 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x72,
+ 0x75, 0x73, 0x74, 0x5f, 0x77, 0x72, 0x69, 0x74,
+ 0x65, 0x5f, 0x78, 0x75, 0x6e, 0x69, 0x6f, 0x6e,
+ 0x2e, 0x63, 0x6d, 0x78, 0x00, 0x00, 0x00, 0x00,
+ },
+ }.check(t)
+ }
+
+ {
v1 := conformance.UnionWithBoundStringStruct{}
v2 := conformance.UnionWithBoundString{}
v3 := "abcd"
@@ -10781,7 +11260,7 @@
v1.V = v2
decodeSuccessCase{
- name: "UnionWithBoundString",
+ name: "UnionWithBoundString_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -10797,6 +11276,31 @@
}
{
+ v1 := conformance.UnionWithBoundStringStruct{}
+ v2 := conformance.UnionWithBoundString{}
+ v3 := "abcd"
+ v2.SetBoundFiveStr(v3)
+ v1.V = v2
+
+ decodeSuccessCase{
+ name: "UnionWithBoundString_v1",
+ context: fidl.MarshalerContext{
+ DecodeUnionsFromXUnionBytes: true,
+ EncodeUnionsAsXUnionBytes: true,
+ },
+ input: &v1,
+ bytes: []byte{
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x61, 0x62, 0x63, 0x64, 0x00, 0x00, 0x00, 0x00,
+ },
+ }.check(t)
+ }
+
+ {
v1 := conformance.SingleVariantUnionStruct{}
v2 := conformance.SingleVariantUnion{}
var v3 uint32 = 42
@@ -10804,7 +11308,7 @@
v1.U = v2
decodeSuccessCase{
- name: "UnionMigration_SingleVariant",
+ name: "UnionMigration_SingleVariant_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -10839,6 +11343,50 @@
}.check(t)
}
+ {
+ v1 := conformance.ReverseOrdinalUnionStruct{}
+ v2 := conformance.ReverseOrdinalUnion{}
+ var v3 int64 = 42
+ v2.SetX(v3)
+ v1.U = v2
+
+ decodeSuccessCase{
+ name: "ReverseOrdinalUnion_old",
+ context: fidl.MarshalerContext{
+ DecodeUnionsFromXUnionBytes: false,
+ EncodeUnionsAsXUnionBytes: false,
+ },
+ input: &v1,
+ bytes: []byte{
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ },
+ }.check(t)
+ }
+
+ {
+ v1 := conformance.ReverseOrdinalUnionStruct{}
+ v2 := conformance.ReverseOrdinalUnion{}
+ var v3 int64 = 42
+ v2.SetX(v3)
+ v1.U = v2
+
+ decodeSuccessCase{
+ name: "ReverseOrdinalUnion_v1",
+ context: fidl.MarshalerContext{
+ DecodeUnionsFromXUnionBytes: true,
+ EncodeUnionsAsXUnionBytes: true,
+ },
+ input: &v1,
+ bytes: []byte{
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ },
+ }.check(t)
+ }
+
}
func TestAllEncodeFailureCases(t *testing.T) {
@@ -10849,7 +11397,7 @@
v1.Xu = v2
encodeFailureCase{
- name: "StrictXUnion Field Not Set",
+ name: "StrictXUnion Field Not Set_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -10860,12 +11408,62 @@
}
{
+ v1 := conformance.TestStrictXUnionInStruct{}
+ v2 := conformance.SampleStrictXUnion{}
+ v1.Xu = v2
+
+ encodeFailureCase{
+ name: "StrictXUnion Field Not Set_v1",
+ context: fidl.MarshalerContext{
+ DecodeUnionsFromXUnionBytes: true,
+ EncodeUnionsAsXUnionBytes: true,
+ },
+ input: &v1,
+ code: fidl.ErrInvalidXUnionTag,
+ }.check(t)
+ }
+
+ {
v1 := conformance.Length2StringWrapper{}
v2 := "abc"
v1.Length2String = v2
encodeFailureCase{
- name: "StringExceedsLimit",
+ name: "StringExceedsLimit_old",
+ context: fidl.MarshalerContext{
+ DecodeUnionsFromXUnionBytes: false,
+ EncodeUnionsAsXUnionBytes: false,
+ },
+ input: &v1,
+ code: fidl.ErrStringTooLong,
+ }.check(t)
+ }
+
+ {
+ v1 := conformance.Length2StringWrapper{}
+ v2 := "abc"
+ v1.Length2String = v2
+
+ encodeFailureCase{
+ name: "StringExceedsLimit_v1",
+ context: fidl.MarshalerContext{
+ DecodeUnionsFromXUnionBytes: true,
+ EncodeUnionsAsXUnionBytes: true,
+ },
+ input: &v1,
+ code: fidl.ErrStringTooLong,
+ }.check(t)
+ }
+
+ {
+ v1 := conformance.UnionWithBoundStringStruct{}
+ v2 := conformance.UnionWithBoundString{}
+ v3 := "abcdef"
+ v2.SetBoundFiveStr(v3)
+ v1.V = v2
+
+ encodeFailureCase{
+ name: "UnionWithBoundString_ExceedsBounds_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -10883,10 +11481,10 @@
v1.V = v2
encodeFailureCase{
- name: "UnionWithBoundString_ExceedsBounds",
+ name: "UnionWithBoundString_ExceedsBounds_v1",
context: fidl.MarshalerContext{
- DecodeUnionsFromXUnionBytes: false,
- EncodeUnionsAsXUnionBytes: false,
+ DecodeUnionsFromXUnionBytes: true,
+ EncodeUnionsAsXUnionBytes: true,
},
input: &v1,
code: fidl.ErrStringTooLong,
@@ -10899,7 +11497,7 @@
{
decodeFailureCase{
- name: "StrictXUnion Field Unknown",
+ name: "StrictXUnion Field Unknown_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,
@@ -10917,7 +11515,7 @@
{
decodeFailureCase{
- name: "NonEmptyStringWithNullPtrBody",
+ name: "NonEmptyStringWithNullPtrBody_old",
context: fidl.MarshalerContext{
DecodeUnionsFromXUnionBytes: false,
EncodeUnionsAsXUnionBytes: false,