aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/glcpp/tests
Commit message (Collapse)AuthorAgeFilesLines
* tests: Make tests aware of meson test wrapperDylan Baker2020-05-201-12/+33
| | | | | | | | | | | | | | | | Meson 0.55.0 will set the MESON_EXE_WRAPPER environment variable to the joined version of that wrapper if it is needed. Our tests that take compiled targets as arguments can use that information to run cross built binaries, or if there isn't a wrapper and we get an ENOEXEC, we can skip the tests gracefully. We try to use mesonlib.split_args, which handles windows arguments better than python's builtin shlex module, but fall back to that if the meson module isn't available for some reason. Cc: 20.0 20.1 <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5103>
* autotools: delete leftover script wrapperEric Engestrom2019-07-311-16/+0
| | | | | | | | Randomly came across this file, which was likely only used by autotools to pass arguments to the test. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* delete autotools .gitignore filesEric Engestrom2019-04-291-4/+0
| | | | | | | | One special case, `src/util/xmlpool/.gitignore` is not entirely deleted, as `xmlpool.pot` still gets generated (eg. by `ninja xmlpool-pot`). Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* configure: allow building with python3Emil Velikov2018-10-311-1/+1
| | | | | | | | | | | | | | | Pretty much all of the scripts are python2+3 compatible. Check and allow using python3, while adjusting the PYTHON2 refs. Note: - python3.4 is used as it's the earliest supported version - python2 chosen prior to python3 v2: use python2 by default Cc: Ilia Mirkin <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Acked-by: Eric Engestrom <[email protected]>
* glsl: ignore trailing whitespace when define redefinedTimothy Arceri2018-10-102-3/+11
| | | | | | | | | The Nvidia/AMD binary drivers allow this, as does GCC. This fixes shader compilation issues in the latest update of No Mans Sky. Reviewed-by: Ian Romanick <[email protected]>
* Revert "configure: allow building with python3"Emil Velikov2018-08-241-1/+1
| | | | | | | | | | | | | | This reverts commit ae7898dfdbe5c8dab7d11c71862353f1ae43feb0. Turns out the python scripts are _not_ fully python 3 compatible. As Ilia reported using get_xmlpool.py with LANG=C produces some weird output - see the link for details. Even though the issue was spotted with the autoconf build, it exposes a genuine problem with the script (and lack of lang handling of the meson build.) https://lists.freedesktop.org/archives/mesa-dev/2018-August/203508.html
* configure: allow building with python3Emil Velikov2018-08-231-1/+1
| | | | | | | | | | | | Pretty much all of the scripts are python2+3 compatible. Check and allow using python3, while adjusting the PYTHON2 refs. Note: - python3.4 is used as it's the earliest supported version - python3 chosen prior to python2 Signed-off-by: Emil Velikov <[email protected]> Acked-by: Eric Engestrom <[email protected]>
* glsl: remove execute bit and shebang from python testsEmil Velikov2018-08-231-1/+0
| | | | | | | | | | | | | Just like the rest of the tree - these should be run either as part of the build system check target, or at the very least with an explicitly versioned python executable. Fixes: db8cd8e3677 ("glcpp/tests: Convert shell scripts to a python script") Fixes: 97c28cb0823 ("glsl/tests: Convert optimization-test.sh to pure python") Fixes: 3b52d292273 ("glsl/tests: reimplement warnings-test in python") Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Dylan Baker <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* python: Disable universal newlinesMathieu Bridon2018-08-221-1/+4
| | | | | | | | | | | | | | | | | | | | | We are testing the behaviour of a tool, for different input files, each one using a different newline sequence. ('\n' on UNIX, '\r\n' on Windows, …) Unfortunately, when opening a file in text mode, Python 3 will by default enable the "universal newlines" mode, which means it replaces all the known newline sequences by '\n'. This (usually useful) behaviour breaks the tests, which are specifically trying to handle files with newline sequences different from '\n'. Disabling the universal newlines mode fixes the tests. However, to keep the script compatible with both Python 2 and 3, we must use the io.open() function instead of the open() builtin, as the latter only knows about the `newline` argument on Python 3. Reviewed-by: Dylan Baker <[email protected]>
* python: difflib prefers unicode stringsMathieu Bridon2018-08-221-1/+2
| | | | | | | | | | Python 3 does not automatically convert from bytes to unicode strings like Python 2 used to do. This commit makes sure we pass unicode strings to difflib.unified_diff, so that the script works on both Python 2 and 3. Reviewed-by: Dylan Baker <[email protected]>
* glsl/tests/glcpp: reinstate "error out if no tests found"Emil Velikov2018-06-211-0/+9
| | | | | | | | | | | | | | | With the recent rework of converting the shell script to a python one the check for actual tests was dropped. Bring that back, since it was explicitly added considering we had a ~2 year period, during which the tests were not run. v2: use raise Exception() over print() & return false (Dylan) Fixes: db8cd8e36771 ("glcpp/tests: Convert shell scripts to a python script") Cc: Dylan Baker <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
* glsl/glcpp/tests: reinstate srcdir/abs_builddir blurbEmil Velikov2018-06-211-0/+13
| | | | | | | | | | | Bring back the "detection" of the said variables, to allow standalone execution. Fixes: db8cd8e36771 ("glcpp/tests: Convert shell scripts to a python script") Cc: Dylan Baker <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* glsl: fold glcpp-test-cr-lf.sh into glcpp-test.shEmil Velikov2018-06-212-4/+1
| | | | | | | | | | | As of recently both of these have been reworked so they invoke a python script. At the same time the latter can be executed with the combined arguments of both scripts. AKA we no longer need to have them separate. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* glsl/glcpp: Handle hex constants with 0X prefixVlad Golovkin2018-04-242-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GLSL 4.6 spec describes hex constant as: hexadecimal-constant: 0x hexadecimal-digit 0X hexadecimal-digit hexadecimal-constant hexadecimal-digit Right now if you have a shader with the following structure: #if 0X1 // or any hex number with the 0X prefix // some code #endif the code between #if and #endif gets removed because the checking is performed only for "0x" prefix which results in strtoll being called with the base 8 and after encountering the 'X' char the strtoll returns 0. Letting strtoll detect the base makes this limitation go away and also makes code easier to read. From the strtoll Linux man page: "If base is zero or 16, the string may then include a "0x" prefix, and the number will be read in base 16; otherwise, a zero base is taken as 10 (decimal) unless the next character is '0', in which case it is taken as 8 (octal)." This matches the behaviour in the GLSL spec. This patch also adds a test for uppercase hex prefix. Reviewed-by: Timothy Arceri <[email protected]>
* compiler/glsl: close fd's in glcpp_test.pyDylan Baker2018-04-231-2/+4
| | | | | | | | | | | | I would have thought falling out of scope would allow the gc to collect these, but apparently it doesn't, and this hits an fd limit on macos. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106133 Fixes: db8cd8e36771eed98eb638fd0593c978c3da52a9 ("glcpp/tests: Convert shell scripts to a python script") Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Tested-by: Vinson Lee <[email protected]>
* glcpp/tests: Convert shell scripts to a python scriptDylan Baker2018-04-183-267/+223
| | | | | | | | | | | This ports glcpp-test.sh and glcpp-test-cr-lf.sh to a python script that accepts arguments for each line ending type. This should allow for better reporting to users. v2: - Use $PYTHON2 to be consistent with other tests in mesa Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* Fix glcpp test expectationsIago Toral Quiroga2017-06-082-3/+6
| | | | | | | | | | With commit f7741985be0234 we have changed some preprocessor error messages and warnings. Adapt related glcpp tests expectations accordingly. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101336 Tested-by: Vinson Lee <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
* glcpp/tests/glcpp-test-cr-lf: error out if we cannot find any testsEmil Velikov2017-03-281-0/+5
| | | | | | Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glcpp/tests/glcpp-test-cr-lf: correctly set/use srcdir/abs_builddirEmil Velikov2017-03-281-14/+17
| | | | | | | | | | | | Otherwise manual invokation of the script from elsewhere than `dirname $0` will fail. With these all the artefacts should be created in the correct location, and thus we can remove the old (and slighly strange) clean-local line. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glcpp/tests: update testname in help stringEmil Velikov2017-03-282-2/+2
| | | | | | | | | Rather than hardcoding glcpp/other use `basename "$0"` which expands appropriatelly. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glcpp/tests/glcpp-test: error out if we cannot find any testsEmil Velikov2017-03-281-0/+5
| | | | | | Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glcpp/tests/glcpp-test: print only the test basenameEmil Velikov2017-03-281-2/+2
| | | | | | Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glcpp/tests/glcpp-test: set srcdir/abs_builddir variablesEmil Velikov2017-03-281-8/+15
| | | | | | | | | | | | Current definitions work fine for the manual invokation of the script, although the whole script does not consider that one can run it OOT. The latter will be handled with latter patches, although it will be extensively using the two variables. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl/tests: suffix .sh/.py files as applicableEmil Velikov2017-03-102-2/+2
| | | | | | | | | This makes it easier/clearer as to: - if the file should have the execute bit set (.py should not) - do we need the shebang in the first place and if so what it should be Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glcpp: Remove illegal characters from testsCarl Worth2017-01-046-6/+6
| | | | | | | | | Some of the existing tests were using '@' and '"' incidentally within the test body. Neither of these characters are actually legal for GLSL. And since we are planning to start generating errors for illegal characters, we need to first make the test suite clean. Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp: Exhaustively test all legal characters in GLSLCarl Worth2017-01-042-0/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here, each legal character (as defined by GLSL Language Specification version 4.30.6, section 3.1) appears at least once in the input file. Obviously, characters with special meaning (like '#' and '\') aren't treated exhaustively with respect to all their possible uses. We have many other tests for that. Here, we're simply ensuring that the test suite sees every legal character at least once. v2 (by Ken): Fix expectations, move to src/compiler, renumber tests. Carl's .expected: Updated .expected: .. .. . . . . . . . . . . . . . . . . . .. . . . . . (For some reason, the original test expected ".." to produce two lines. glcpp, cpp, and mcpp all follow my updated behavior, so I believe it to be correct.) Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp: Add testing for no space between macro name and replacement listCarl Worth2017-01-042-0/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | GCC's preprocessor accepts a macro definition where there is no space between the macro's identifier name and the replacementlist. (GCC does emit a "missing space" warning that we don't, but that's fine.) This is an exhaustive test that verifies that all legal GLSL characters that could possibly be interpreted as separating the macro name from the replacement list are interpreted as such. So the testing here includes all valid GLSL symbols except for: * Characters that can be part of an identifier (a-z, A-Z, 0-9, _) * Backslash, (allowed only as line continuation) * Hash, (allowed only to introduce pre-processor directive, or as part of a paste operator in a replacement list---but not as first token of replacement list) * Space characters (since the point of the testing is to have missing space) * Left parenthesis (which would indicate a function-like macro) v2 (Ken): Move to src/compiler, renumber tests. Reviewed-by: Kenneth Graunke <[email protected]>
* glcpp: Update tests for new #undef of built-in macro rules.Kenneth Graunke2016-08-154-1/+11
| | | | | | | | | | | | | | Ian recently changed the preprocessor to allow this in most GLSL versions, but not GLSL ES 3.00+. This patch converts the existing test that expects a failure to a #version 300 es shader, and adds a #version 110 shader to make sure that it's allowed. Fixes 'make check'. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97307 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Tested-by: Vinson Lee <[email protected]>
* glcpp: Fix locations when encounting "#<NEWLINE>".Kenneth Graunke2016-03-101-1/+1
| | | | | | | | | | | | | | | We were failing to reset our location tracking when encountering a NEWLINE in the <HASH> state. Rip the code from the <*>{NEWLINE} rule, which handles this properly. Also, update 146-version-first-hash.c to have proper expectations. When I introduced the test, I didn't verify that the line/column numbers were correct, and it turns out they varied based on the type of newline ending. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94447 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* glcpp: Remove empty mid-rule action which changes test behavior.Kenneth Graunke2016-03-071-1/+1
| | | | | | | | | | Apparently this causes a slight difference in the parser's token expectations, leading to a different error message. It seems harmless, but I wanted to be cautious and separate it out. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glcpp: Implicitly resolve version after the first non-space/hash token.Kenneth Graunke2016-03-076-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We resolved the implicit version directive when processing control lines, such as #ifdef, to ensure any built-in macros exist. However, we failed to resolve it when handling ordinary text. For example, int x = __VERSION__; should resolve __VERSION__ to 110, but since we never resolved the implicit version, none of the built-in macros exist, so it was left as is. This also meant we allowed the following shader to slop through: 123 #version 120 Nothing would cause the implicit version to take effect, so when we saw the #version directive, we thought everything was peachy. This patch makes the lexer's per-token action resolve the implicit version on the first non-space/newline/hash token that isn't part of a #version directive, fulfilling the GLSL language spec: "The #version directive must occur in a shader before anything else, except for comments and white space." Because we emit #version as HASH_TOKEN then VERSION_TOKEN, we have to allow HASH_TOKEN to slop through as well, so we don't resolve the implicit version as soon as we see the # character. However, this is fine, because the parser's HASH_TOKEN NEWLINE rule does resolve the version, disallowing cases like: # #version 120 This patch also adds the above shaders as new glcpp tests. Fixes dEQP-GLES2.functional.shaders.preprocessor.predefined_macros. {gl_es_1_vertex,gl_es_1_fragment}. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: move to compiler/Emil Velikov2016-01-26291-0/+2440
Signed-off-by: Emil Velikov <[email protected]> Acked-by: Matt Turner <[email protected]> Acked-by: Jose Fonseca <[email protected]>