Cleaned up several DISABLED unit tests
Many were redundant, some were now fixed. Change-Id: Iecc761fbed82764cd25224f843d754c5948422ad Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82681 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
b37221a1cb
commit
d1003645cb
|
@ -178,66 +178,6 @@ fn f() {
|
||||||
EXPECT_EQ(expect, str(got));
|
EXPECT_EQ(expect, str(got));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(crbug.com/676): Possibly enable if the spec allows for access
|
|
||||||
// attributes in type aliases. If not, just remove.
|
|
||||||
TEST_F(BindingRemapperTest, DISABLED_RemapAccessControlsWithAliases) {
|
|
||||||
auto* src = R"(
|
|
||||||
struct S {
|
|
||||||
a : f32;
|
|
||||||
};
|
|
||||||
|
|
||||||
type, read ReadOnlyS = S;
|
|
||||||
|
|
||||||
type, write WriteOnlyS = S;
|
|
||||||
|
|
||||||
type A = S;
|
|
||||||
|
|
||||||
@group(2) @binding(1) var<storage> a : ReadOnlyS;
|
|
||||||
|
|
||||||
@group(3) @binding(2) var<storage> b : WriteOnlyS;
|
|
||||||
|
|
||||||
@group(4) @binding(3) var<storage> c : A;
|
|
||||||
|
|
||||||
@stage(compute) @workgroup_size(1)
|
|
||||||
fn f() {
|
|
||||||
}
|
|
||||||
)";
|
|
||||||
|
|
||||||
auto* expect = R"(
|
|
||||||
struct S {
|
|
||||||
a : f32;
|
|
||||||
};
|
|
||||||
|
|
||||||
type, read ReadOnlyS = S;
|
|
||||||
|
|
||||||
type, write WriteOnlyS = S;
|
|
||||||
|
|
||||||
type A = S;
|
|
||||||
|
|
||||||
@group(2) @binding(1) var<storage, write> a : S;
|
|
||||||
|
|
||||||
@group(3) @binding(2) var<storage> b : WriteOnlyS;
|
|
||||||
|
|
||||||
@group(4) @binding(3) var<storage, write> c : S;
|
|
||||||
|
|
||||||
@stage(compute) @workgroup_size(1)
|
|
||||||
fn f() {
|
|
||||||
}
|
|
||||||
)";
|
|
||||||
|
|
||||||
DataMap data;
|
|
||||||
data.Add<BindingRemapper::Remappings>(
|
|
||||||
BindingRemapper::BindingPoints{},
|
|
||||||
BindingRemapper::AccessControls{
|
|
||||||
{{2, 1}, ast::Access::kWrite}, // Modify access control
|
|
||||||
// Keep @group(3) @binding(2) as is
|
|
||||||
{{4, 3}, ast::Access::kRead}, // Add access control
|
|
||||||
});
|
|
||||||
auto got = Run<BindingRemapper>(src, data);
|
|
||||||
|
|
||||||
EXPECT_EQ(expect, str(got));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(BindingRemapperTest, RemapAll) {
|
TEST_F(BindingRemapperTest, RemapAll) {
|
||||||
auto* src = R"(
|
auto* src = R"(
|
||||||
struct S {
|
struct S {
|
||||||
|
|
|
@ -192,17 +192,16 @@ TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Array) {
|
||||||
"vec3(7.0f, 8.0f, 9.0f))"));
|
"vec3(7.0f, 8.0f, 9.0f))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(bclayton): Zero-init arrays
|
TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Array_Empty) {
|
||||||
TEST_F(GlslGeneratorImplTest_Constructor,
|
|
||||||
DISABLED_EmitConstructor_Type_Array_Empty) {
|
|
||||||
WrapInFunction(Construct(ty.array(ty.vec3<f32>(), 3)));
|
WrapInFunction(Construct(ty.array(ty.vec3<f32>(), 3)));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||||
EXPECT_THAT(gen.result(),
|
EXPECT_THAT(
|
||||||
HasSubstr("{vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f),"
|
gen.result(),
|
||||||
" vec3(0.0f, 0.0f, 0.0f)}"));
|
HasSubstr("vec3[3](vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f),"
|
||||||
|
" vec3(0.0f, 0.0f, 0.0f))"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Struct) {
|
TEST_F(GlslGeneratorImplTest_Constructor, EmitConstructor_Type_Struct) {
|
||||||
|
|
|
@ -58,21 +58,6 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_ArrayOfArray) {
|
||||||
EXPECT_EQ(out.str(), "bool ary[5][4]");
|
EXPECT_EQ(out.str(), "bool ary[5][4]");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(dsinclair): Is this possible? What order should it output in?
|
|
||||||
TEST_F(GlslGeneratorImplTest_Type,
|
|
||||||
DISABLED_EmitType_ArrayOfArrayOfRuntimeArray) {
|
|
||||||
auto* arr = ty.array(ty.array(ty.array<bool, 4>(), 5), 0);
|
|
||||||
Global("G", arr, ast::StorageClass::kPrivate);
|
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
|
||||||
|
|
||||||
std::stringstream out;
|
|
||||||
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(arr), ast::StorageClass::kNone,
|
|
||||||
ast::Access::kReadWrite, "ary"))
|
|
||||||
<< gen.error();
|
|
||||||
EXPECT_EQ(out.str(), "bool ary[5][4][1]");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Type, EmitType_ArrayOfArrayOfArray) {
|
TEST_F(GlslGeneratorImplTest_Type, EmitType_ArrayOfArrayOfArray) {
|
||||||
auto* arr = ty.array(ty.array(ty.array<bool, 4>(), 5), 6);
|
auto* arr = ty.array(ty.array(ty.array<bool, 4>(), 5), 6);
|
||||||
Global("G", arr, ast::StorageClass::kPrivate);
|
Global("G", arr, ast::StorageClass::kPrivate);
|
||||||
|
@ -149,21 +134,6 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Matrix) {
|
||||||
EXPECT_EQ(out.str(), "mat2x3");
|
EXPECT_EQ(out.str(), "mat2x3");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(dsinclair): How to annotate as workgroup?
|
|
||||||
TEST_F(GlslGeneratorImplTest_Type, DISABLED_EmitType_Pointer) {
|
|
||||||
auto* f32 = create<sem::F32>();
|
|
||||||
auto* p = create<sem::Pointer>(f32, ast::StorageClass::kWorkgroup,
|
|
||||||
ast::Access::kReadWrite);
|
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
|
||||||
|
|
||||||
std::stringstream out;
|
|
||||||
ASSERT_TRUE(gen.EmitType(out, p, ast::StorageClass::kNone,
|
|
||||||
ast::Access::kReadWrite, ""))
|
|
||||||
<< gen.error();
|
|
||||||
EXPECT_EQ(out.str(), "float*");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(GlslGeneratorImplTest_Type, EmitType_StructDecl) {
|
TEST_F(GlslGeneratorImplTest_Type, EmitType_StructDecl) {
|
||||||
auto* s = Structure("S", {
|
auto* s = Structure("S", {
|
||||||
Member("a", ty.i32()),
|
Member("a", ty.i32()),
|
||||||
|
|
|
@ -219,17 +219,13 @@ TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Array) {
|
||||||
" float3(7.0f, 8.0f, 9.0f)}"));
|
" float3(7.0f, 8.0f, 9.0f)}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(bclayton): Zero-init arrays
|
TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Array_Empty) {
|
||||||
TEST_F(HlslGeneratorImplTest_Constructor,
|
|
||||||
DISABLED_EmitConstructor_Type_Array_Empty) {
|
|
||||||
WrapInFunction(Construct(ty.array(ty.vec3<f32>(), 3)));
|
WrapInFunction(Construct(ty.array(ty.vec3<f32>(), 3)));
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
ASSERT_TRUE(gen.Generate()) << gen.error();
|
ASSERT_TRUE(gen.Generate()) << gen.error();
|
||||||
EXPECT_THAT(gen.result(),
|
EXPECT_THAT(gen.result(), HasSubstr("(float3[3])0"));
|
||||||
HasSubstr("{float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f),"
|
|
||||||
" float3(0.0f, 0.0f, 0.0f)}"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Struct) {
|
TEST_F(HlslGeneratorImplTest_Constructor, EmitConstructor_Type_Struct) {
|
||||||
|
|
|
@ -58,21 +58,6 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_ArrayOfArray) {
|
||||||
EXPECT_EQ(out.str(), "bool ary[5][4]");
|
EXPECT_EQ(out.str(), "bool ary[5][4]");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(dsinclair): Is this possible? What order should it output in?
|
|
||||||
TEST_F(HlslGeneratorImplTest_Type,
|
|
||||||
DISABLED_EmitType_ArrayOfArrayOfRuntimeArray) {
|
|
||||||
auto* arr = ty.array(ty.array(ty.array<bool, 4>(), 5));
|
|
||||||
Global("G", arr, ast::StorageClass::kPrivate);
|
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
|
||||||
|
|
||||||
std::stringstream out;
|
|
||||||
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(arr), ast::StorageClass::kNone,
|
|
||||||
ast::Access::kReadWrite, "ary"))
|
|
||||||
<< gen.error();
|
|
||||||
EXPECT_EQ(out.str(), "bool ary[5][4][1]");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Type, EmitType_ArrayOfArrayOfArray) {
|
TEST_F(HlslGeneratorImplTest_Type, EmitType_ArrayOfArrayOfArray) {
|
||||||
auto* arr = ty.array(ty.array(ty.array<bool, 4>(), 5), 6);
|
auto* arr = ty.array(ty.array(ty.array<bool, 4>(), 5), 6);
|
||||||
Global("G", arr, ast::StorageClass::kPrivate);
|
Global("G", arr, ast::StorageClass::kPrivate);
|
||||||
|
@ -149,21 +134,6 @@ TEST_F(HlslGeneratorImplTest_Type, EmitType_Matrix) {
|
||||||
EXPECT_EQ(out.str(), "float2x3");
|
EXPECT_EQ(out.str(), "float2x3");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(dsinclair): How to annotate as workgroup?
|
|
||||||
TEST_F(HlslGeneratorImplTest_Type, DISABLED_EmitType_Pointer) {
|
|
||||||
auto* f32 = create<sem::F32>();
|
|
||||||
auto* p = create<sem::Pointer>(f32, ast::StorageClass::kWorkgroup,
|
|
||||||
ast::Access::kReadWrite);
|
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
|
||||||
|
|
||||||
std::stringstream out;
|
|
||||||
ASSERT_TRUE(gen.EmitType(out, p, ast::StorageClass::kNone,
|
|
||||||
ast::Access::kReadWrite, ""))
|
|
||||||
<< gen.error();
|
|
||||||
EXPECT_EQ(out.str(), "float*");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(HlslGeneratorImplTest_Type, EmitType_StructDecl) {
|
TEST_F(HlslGeneratorImplTest_Type, EmitType_StructDecl) {
|
||||||
auto* s = Structure("S", {
|
auto* s = Structure("S", {
|
||||||
Member("a", ty.i32()),
|
Member("a", ty.i32()),
|
||||||
|
|
|
@ -670,8 +670,7 @@ TEST_F(MslGeneratorImplTest, AttemptTintPadSymbolCollision) {
|
||||||
)");
|
)");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(dsinclair): How to translate @block
|
TEST_F(MslGeneratorImplTest, EmitType_Struct_WithAttribute) {
|
||||||
TEST_F(MslGeneratorImplTest, DISABLED_EmitType_Struct_WithAttribute) {
|
|
||||||
auto* s = Structure("S",
|
auto* s = Structure("S",
|
||||||
{
|
{
|
||||||
Member("a", ty.i32()),
|
Member("a", ty.i32()),
|
||||||
|
@ -687,12 +686,14 @@ TEST_F(MslGeneratorImplTest, DISABLED_EmitType_Struct_WithAttribute) {
|
||||||
|
|
||||||
GeneratorImpl& gen = Build();
|
GeneratorImpl& gen = Build();
|
||||||
|
|
||||||
std::stringstream out;
|
TextGenerator::TextBuffer buf;
|
||||||
ASSERT_TRUE(gen.EmitType(out, program->TypeOf(s), "")) << gen.error();
|
auto* sem_s = program->TypeOf(s)->As<sem::Struct>();
|
||||||
EXPECT_EQ(out.str(), R"(struct {
|
ASSERT_TRUE(gen.EmitStructType(&buf, sem_s)) << gen.error();
|
||||||
|
EXPECT_EQ(buf.String(), R"(struct S {
|
||||||
/* 0x0000 */ int a;
|
/* 0x0000 */ int a;
|
||||||
/* 0x0004 */ float b;
|
/* 0x0004 */ float b;
|
||||||
})");
|
};
|
||||||
|
)");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MslGeneratorImplTest, EmitType_U32) {
|
TEST_F(MslGeneratorImplTest, EmitType_U32) {
|
||||||
|
|
|
@ -22,9 +22,7 @@ namespace {
|
||||||
|
|
||||||
using BuilderTest = TestHelper;
|
using BuilderTest = TestHelper;
|
||||||
|
|
||||||
// TODO(amaiorano): Disabled because Resolver now emits "redeclared identifier
|
TEST_F(BuilderTest, Block) {
|
||||||
// 'var'".
|
|
||||||
TEST_F(BuilderTest, DISABLED_Block) {
|
|
||||||
// Note, this test uses shadow variables which aren't allowed in WGSL but
|
// Note, this test uses shadow variables which aren't allowed in WGSL but
|
||||||
// serves to prove the block code is pushing new scopes as needed.
|
// serves to prove the block code is pushing new scopes as needed.
|
||||||
auto* inner = Block(Decl(Var("var", ty.f32(), ast::StorageClass::kNone)),
|
auto* inner = Block(Decl(Var("var", ty.f32(), ast::StorageClass::kNone)),
|
||||||
|
|
Loading…
Reference in New Issue