In order to implement the "uninitialized variable" warning it was needed to hande several corner cases manually. Recently I sent a series to fix the last false positive: https://lists.freedesktop.org/archives/mesa-dev/2016-April/113614.html
At this point I think that it would be better to include some unit tests, to ensure that changes on glsl doesn't break the warning, being false positives the worst problem (imho). This series add those tests. This is basically a set of shaders, and the expected InfoLog. It uses the standalone compiler to compile those shaders, and use just a diff to compare with the expected outcome. It is not exactly really formal, but I think that would work fine. This could be used to test the expected warnings for any kind of warning, but the series is focused on the "unitialized warning" warning. Alejandro Piñeiro (3): glsl: add just-log option for the standalone compiler. glsl: add warning-test glsl: add unit tests data vertex/expected outcome for unitialized warning src/compiler/Makefile.glsl.am | 3 ++- src/compiler/glsl/main.cpp | 20 +++++++++++--- src/compiler/glsl/tests/warnings-test | 31 ++++++++++++++++++++++ .../glsl/tests/warnings/000-basic-test.vert | 10 +++++++ .../tests/warnings/000-basic-test.vert.expected | 1 + .../warnings/001-use-undefined-then-define.vert | 12 +++++++++ .../001-use-undefined-then-define.vert.expected | 1 + src/compiler/glsl/tests/warnings/002-loop.vert | 23 ++++++++++++++++ .../glsl/tests/warnings/002-loop.vert.expected | 3 +++ src/compiler/glsl/tests/warnings/003-less.vert | 17 ++++++++++++ .../glsl/tests/warnings/003-less.vert.expected | 1 + src/compiler/glsl/tests/warnings/004-greater.vert | 17 ++++++++++++ .../glsl/tests/warnings/004-greater.vert.expected | 1 + src/compiler/glsl/tests/warnings/005-lequal.vert | 17 ++++++++++++ .../glsl/tests/warnings/005-lequal.vert.expected | 1 + src/compiler/glsl/tests/warnings/006-gequal.vert | 17 ++++++++++++ .../glsl/tests/warnings/006-gequal.vert.expected | 1 + src/compiler/glsl/tests/warnings/007-test-mod.vert | 25 +++++++++++++++++ .../glsl/tests/warnings/007-test-mod.vert.expected | 3 +++ .../glsl/tests/warnings/008-mulassign.vert | 12 +++++++++ .../tests/warnings/008-mulassign.vert.expected | 1 + .../glsl/tests/warnings/009-div-assign.vert | 12 +++++++++ .../tests/warnings/009-div-assign.vert.expected | 1 + .../glsl/tests/warnings/010-add-assign.vert | 12 +++++++++ .../tests/warnings/010-add-assign.vert.expected | 1 + .../glsl/tests/warnings/011-sub-assign.vert | 12 +++++++++ .../tests/warnings/011-sub-assign.vert.expected | 1 + .../glsl/tests/warnings/012-modassign.vert | 12 +++++++++ .../tests/warnings/012-modassign.vert.expected | 1 + src/compiler/glsl/tests/warnings/013-lsassign.vert | 12 +++++++++ .../glsl/tests/warnings/013-lsassign.vert.expected | 1 + src/compiler/glsl/tests/warnings/014-rsassign.vert | 12 +++++++++ .../glsl/tests/warnings/014-rsassign.vert.expected | 1 + .../glsl/tests/warnings/015-andassign.vert | 12 +++++++++ .../tests/warnings/015-andassign.vert.expected | 1 + src/compiler/glsl/tests/warnings/016-orassign.vert | 12 +++++++++ .../glsl/tests/warnings/016-orassign.vert.expected | 1 + .../glsl/tests/warnings/017-xorassign.vert | 12 +++++++++ .../tests/warnings/017-xorassign.vert.expected | 1 + src/compiler/glsl/tests/warnings/018-bitand.vert | 24 +++++++++++++++++ .../glsl/tests/warnings/018-bitand.vert.expected | 3 +++ src/compiler/glsl/tests/warnings/019-array.vert | 23 ++++++++++++++++ .../glsl/tests/warnings/019-array.vert.expected | 5 ++++ .../glsl/tests/warnings/020-array-length.vert | 12 +++++++++ .../tests/warnings/020-array-length.vert.expected | 0 src/compiler/glsl/tests/warnings/021-lshift.vert | 25 +++++++++++++++++ .../glsl/tests/warnings/021-lshift.vert.expected | 3 +++ src/compiler/glsl/tests/warnings/022-rshift.vert | 25 +++++++++++++++++ .../glsl/tests/warnings/022-rshift.vert.expected | 3 +++ src/compiler/glsl/tests/warnings/023-switch.vert | 28 +++++++++++++++++++ .../glsl/tests/warnings/023-switch.vert.expected | 3 +++ .../glsl/tests/warnings/024-shaderout.vert | 19 +++++++++++++ .../tests/warnings/024-shaderout.vert.expected | 2 ++ .../025-out-inout-function-parameters.vert | 16 +++++++++++ ...025-out-inout-function-parameters.vert.expected | 1 + .../glsl/tests/warnings/026-conditional.vert | 17 ++++++++++++ .../tests/warnings/026-conditional.vert.expected | 6 +++++ .../glsl/tests/warnings/027-fieldselection.vert | 23 ++++++++++++++++ .../warnings/027-fieldselection.vert.expected | 1 + 59 files changed, 568 insertions(+), 5 deletions(-) create mode 100755 src/compiler/glsl/tests/warnings-test create mode 100644 src/compiler/glsl/tests/warnings/000-basic-test.vert create mode 100644 src/compiler/glsl/tests/warnings/000-basic-test.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/001-use-undefined-then-define.vert create mode 100644 src/compiler/glsl/tests/warnings/001-use-undefined-then-define.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/002-loop.vert create mode 100644 src/compiler/glsl/tests/warnings/002-loop.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/003-less.vert create mode 100644 src/compiler/glsl/tests/warnings/003-less.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/004-greater.vert create mode 100644 src/compiler/glsl/tests/warnings/004-greater.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/005-lequal.vert create mode 100644 src/compiler/glsl/tests/warnings/005-lequal.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/006-gequal.vert create mode 100644 src/compiler/glsl/tests/warnings/006-gequal.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/007-test-mod.vert create mode 100644 src/compiler/glsl/tests/warnings/007-test-mod.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/008-mulassign.vert create mode 100644 src/compiler/glsl/tests/warnings/008-mulassign.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/009-div-assign.vert create mode 100644 src/compiler/glsl/tests/warnings/009-div-assign.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/010-add-assign.vert create mode 100644 src/compiler/glsl/tests/warnings/010-add-assign.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/011-sub-assign.vert create mode 100644 src/compiler/glsl/tests/warnings/011-sub-assign.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/012-modassign.vert create mode 100644 src/compiler/glsl/tests/warnings/012-modassign.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/013-lsassign.vert create mode 100644 src/compiler/glsl/tests/warnings/013-lsassign.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/014-rsassign.vert create mode 100644 src/compiler/glsl/tests/warnings/014-rsassign.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/015-andassign.vert create mode 100644 src/compiler/glsl/tests/warnings/015-andassign.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/016-orassign.vert create mode 100644 src/compiler/glsl/tests/warnings/016-orassign.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/017-xorassign.vert create mode 100644 src/compiler/glsl/tests/warnings/017-xorassign.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/018-bitand.vert create mode 100644 src/compiler/glsl/tests/warnings/018-bitand.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/019-array.vert create mode 100644 src/compiler/glsl/tests/warnings/019-array.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/020-array-length.vert create mode 100644 src/compiler/glsl/tests/warnings/020-array-length.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/021-lshift.vert create mode 100644 src/compiler/glsl/tests/warnings/021-lshift.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/022-rshift.vert create mode 100644 src/compiler/glsl/tests/warnings/022-rshift.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/023-switch.vert create mode 100644 src/compiler/glsl/tests/warnings/023-switch.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/024-shaderout.vert create mode 100644 src/compiler/glsl/tests/warnings/024-shaderout.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/025-out-inout-function-parameters.vert create mode 100644 src/compiler/glsl/tests/warnings/025-out-inout-function-parameters.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/026-conditional.vert create mode 100644 src/compiler/glsl/tests/warnings/026-conditional.vert.expected create mode 100644 src/compiler/glsl/tests/warnings/027-fieldselection.vert create mode 100644 src/compiler/glsl/tests/warnings/027-fieldselection.vert.expected -- 2.5.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev