DirectXShaderCompiler icon indicating copy to clipboard operation
DirectXShaderCompiler copied to clipboard

Add test for lib for keep init function for static global.

Open python3kgae opened this issue 2 years ago • 5 comments

python3kgae avatar Sep 03 '22 00:09 python3kgae

:x: Build DirectXShaderCompiler 1.0.1961 failed (commit https://github.com/microsoft/DirectXShaderCompiler/commit/adf6f5d2d8 by @python3kgae)

AppVeyorBot avatar Sep 03 '22 02:09 AppVeyorBot

:white_check_mark: Build DirectXShaderCompiler 1.0.1963 completed (commit https://github.com/microsoft/DirectXShaderCompiler/commit/2629fe086b by @python3kgae)

AppVeyorBot avatar Sep 03 '22 07:09 AppVeyorBot

I know that DXC doesn't have the full features that LIT supports in LLVM, but I don't think this test meaningfully verifies the behavior of global initializers.

The missing test coverage that I commented on was that we don't have any test coverage of the global constructor generation for library shaders in DXC. This doesn't cover that case.

I'm also not sure if we have test coverage of the linking behavior, which this gets closer to, but I feel like this code makes a few pretty big leaps and is a bit light on verification of results.

llvm-beanz avatar Sep 08 '22 16:09 llvm-beanz

Note: you can do this from a filecheck test more easily. See example for compilation + linking in tools/clang/test/HLSLFileCheck/shader_targets/library/link_mismatch_target.hlsl. It basically involves compiling with -Fo <name> to capture to virtual file, then in a later RUN line, using %dxl with the lib1;lib2 syntax where lib1 comes from -Fo lib1 from a previous step. It's easier to write and maintain tests this way.

tex3d avatar Sep 27 '22 18:09 tex3d

:x: Build DirectXShaderCompiler 1.0.2100 failed (commit https://github.com/microsoft/DirectXShaderCompiler/commit/3641d99904 by @python3kgae)

AppVeyorBot avatar Sep 29 '22 01:09 AppVeyorBot