aboutsummaryrefslogtreecommitdiff
path: root/test cases/common
AgeCommit message (Collapse)AuthorFilesLines
2023-09-13install_{data,headers,subdir}: implement follow_symlinksArsen Arsenović5-0/+55
This permits users who rely on following symlinks to stay on the old default of following them.
2023-09-13Fix assertion raised with invalid option nameCharles Brunet1-0/+8
When option name contains more that one dot, it should be detected earlier to prevent an assert to be raised. Fixes #11904.
2023-09-09Add support for padding zeroes in int.to_string() methodNomura1-0/+9
2023-09-09Add macro_name option to configure_fileNicholas Vinson2-0/+32
Allow macro_name to be speficied as a parameter to configure_file(). This allows C macro-style include guards to be added to configure_file()'s output when a template file is not given. This change simplifies the creation of configure files that define macros with dynamic names and want the C-style include guards.
2023-09-07Fix include_directories test for relative pathCharles Brunet2-0/+29
- On Windows, it was not detected if include directory was an absolute path to source directory, because of the mis of path separators. - In the edgecase the include directory begins with the exact same string as the source directory, but is a different directory, it was falsely reported as an error. Fixes #12217.
2023-09-07Compiler checks must use per-subproject optionsXavier Claessens1-0/+4
Fixes: #12202
2023-09-07Add compiler.has_defineMarvin Scholz1-40/+49
Adds a new method to the compiler object, has_define. This makes it possible to check if a preprocessor macro/define is set or not. This is especially helpful if the define in question is empty, for example: #define MESON_EMPTY_DEFINE This would yield the same results as a missing define with the existing get_define method, as it would return an empty string for both cases. Therefore this additional method is needed.
2023-08-31add json output format to configure fileCharles Brunet5-0/+82
2023-08-28include_directories: Always add both source and build dirsXavier Claessens2-0/+13
Compiler checks were not adding build dir side, which prevents using headers generated with configure_file().
2023-08-24find_program: Fallback if version mismatchXavier Claessens5-0/+21
Fixes: #11797
2023-08-22compilers: fix checks handling of internal dependenciesBenoit Pierre2-0/+8
The include directories were not passed to the compiler.
2023-08-18Revert "Revert "Add fs.relative_to()""Tristan Partin3-1/+59
This reverts commit 84c8905d527893bedc673e8a036b8b2ec89368b4. Fixed the cygwin failure...
2023-08-17Revert "Add fs.relative_to()"Eli Schwartz3-63/+1
This reverts commit f52bcaa27fc125ab9ae583af466ba99c164169f3. It did not pass CI, and was merged anyway because there were two CI errors in the same cygwin job. The other error was not the fault of this commit, and since cygwin errors were glossed over because they were "expected", the presence of a new error *added* by this commit was overlooked. Per the meson development policy, PRs which result in CI errors can/should be reverted at will, no questions asked.
2023-08-17skip test on pkgconf 2.0.1 that is broken there due to a reported bugEli Schwartz1-0/+4
2023-08-17Remove hacky setup for CustomTargetIndex tests in fs.relative_to()Tristan Partin1-21/+5
2023-08-17Add fs.relative_to()Tristan Partin3-1/+79
Returns a relative path from arg 2 to arg 1 similar to os.path.relpath().
2023-08-16fs.read(): Catch FileNotFoundErrorXavier Claessens1-0/+4
2023-08-07Compiler: Add werror kwarg to compiles(), links() and run() methodsXavier Claessens1-0/+23
Fixes: #5399
2023-08-05compiler: Add required keyword to has_* methodsXavier Claessens2-0/+68
add the "required" keyword to the functions has_function has_type has_member has_members has_argument has_multi_arguments has_link_argument has_multi_link_argument has_function_attribute Co-authored-by: Milan Hauth <milahu@gmail.com>
2023-08-04Add default_options argument to find_program()Nomura5-0/+20
2023-08-02Unify message(), format() and fstring formattingXavier Claessens3-0/+49
Share a common function to convert objects to display strings for consistency. While at it, also add support for formatting user options.
2023-08-02treewide: internally avoid deprecated machine file uses of "pkgconfig"Eli Schwartz1-1/+1
We support this in a machine file: ``` [binaries] pkgconfig = 'pkg-config' pkg-config = 'pkg-config' ``` and you can use either one, because internally we look up both. If you only set *one* of them, this plays awkwardly with setting $PKG_CONFIG, since we don't know which one you set in the machine file and the *other* one will be initialized from the environment instead. In commit 22df45a31981874310a78dde0df59a6a7c5ebb29 we changed program lookup of config-tool style dependencies to use the regular tool names and only fall back on the strange internal names. This affected the pkg-config class too. The result is that instead of preferring `pkgconfig =` followed by $PKG_CONFIG followed by `pkg-config =`, we inverted the lookup order. This is a good idea anyway, because now it behaves consistently with `find_program('pkg-config')`. Unfortunately, we documented the wrong name in a bunch of places, and also used the wrong name in various testsuite bits, which meant that if you set $PKG_CONFIG and then ran the testsuite, it would fail. Correct these references, because they are buggy. One test case expected to find_program() a native copy for convenience of testing against natively installed glib. Force it to resolve a native copy.
2023-07-26Fix install_data() default install pathDaniele Nicolodi5-1/+11
This fixes two issues in constructing the default installation path when install_dir is not specified: - inside a subproject, install_data() would construct the destination path using the parent project name instead than the current project name, - when specifying preserve_path, install_data() would construct the destination path omitting the project name. Fixes #11910.
2023-07-14compiler.compiles/links: fix failure when compiling a built File objectEli Schwartz1-5/+12
In order to pass a File object down into the compiler impl and compile it, we cannot pass a string with the filename, and we cannot either pass the File object as-is, since it relies on being given Environment attributes to calculate the relative location. So we build a fresh File object as an absolute path. But the code to do this was totally broken. Instead of using the File method to get an absolute path, we used one that expected to create builddir-relative paths... and then gave it the absolute source dir as the "relative path portion" prefix. This worked by accident as long as it wasn't a built File, but if it was a built file then we intentionally didn't include that prefix -- which was wrong anyway, since we need the build directory! Use the correct method to get an absolute path in all cases, and emit a warning if it was a built file. This never worked. Sometimes it crashed, sometimes it silently returned false. Fixes #11983
2023-07-13Silence some encoding warningsTristan Partin2-4/+4
By specifiying explicit encodings, we can silence warnings like: /__w/meson/meson/test cases/common/100 postconf with args/postconf.py:15: EncodingWarning: 'encoding' argument not specified with open(input_file) as f: in CI.
2023-07-05comp.preprocess(): Do not treat every file as assemblyXavier Claessens2-1/+4
Fixes: #11940
2023-07-04tests: add standard option to get_define() testKacper Michajłow1-0/+10
This properly tests MSVC case which produce different preprocessed output depending on language version.
2023-06-28Condense test directory names for release.Jussi Pakkanen3-0/+0
2023-06-20interpreter: Accept more types in default_options dict valuesXavier Claessens3-0/+27
2023-06-20add str.splitlines methodMartin Dørum1-0/+12
The new splitlines method on str is intended to replace usage of fs.read('whatever').strip().split('\n'). The problem with the .strip().split() approach is that it doesn't have a way to represent empty lists (an empty string becomes a list with one empty string, not an empty list), and it doesn't handle Windows-style line endings.
2023-06-01pkgconfig: Add include directories from internal deps in -uninstalled.pcXavier Claessens6-0/+29
Fixes: #8651
2023-05-31preprocess: Allow preprocessing any file extensionsXavier Claessens1-3/+3
2023-05-21Allow generator.process(generator.process(...))Volker Weißmann4-0/+32
Fixes #1141
2023-05-02python module: add an automatic byte-compilation stepEli Schwartz1-1/+1
For all source `*.py` files installed via either py.install_sources() or an `install_dir: py.get_install_dir()`, produce `*.pyc` files at install time. Controllable via a module option.
2023-04-27Specify c++ 11 flag as code uses c++ 11 featuresPeter Hull1-1/+2
2023-04-18pkgconfig module: fix traceback on invalid missing descriptionEli Schwartz1-0/+9
If the optional first "mainlib" argument is there, then we infer several values. Otherwise, some of those values fall back to a generic default, and two of them -- name and description -- fall back to being mandatory. In commit e84f293f672a372d2434d0ce4fa39d3f902b6ce8, we removed validation for description as part of refactoring that never actually validated anything.
2023-04-14minstall: Fix install_subdir() excludes with path separators on WinDaniele Nicolodi5-0/+10
The paths in meson.build use / as path separator, however, the paths constructed during the directory structure walk use native path separators, thus the path never compare equal to the excluded ones. Normalize the exclusion paths before the comparison.
2023-04-11fix various spelling issuesJosh Soref24-22/+22
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-11Change "can not" to "cannot" throughout projectHiPhish5-5/+5
The word "cannot" expresses inability to do something whereas "can not" expresses the ability to refrain from doing something.
2023-04-04propagate the most accurate node to error messagesEli Schwartz1-1/+1
During evaluation of codeblocks, we start off with an iteration of nodes, and then while evaluating them we may update the global self.current_node context. When catching and formatting errors, we didn't take into account that the node might be updated from the original top-level iteration. Switch to formatting errors using self.current_node instead, to ensure we can point at the likely most-accurate actual cause of an error. Also update the current node in a few more places, so that function calls always see the function call as the current node, even if the most recently parsed node was an argument to the function call. Fixes #11643
2023-04-03tests/94 threads: fix build error with clang 16Christoph Reiter1-1/+1
It fails with "incompatible-function-pointer-types" otherwise
2023-03-30tests: add test to ensure that build dir is preferred to src dirBarnabás Pőcze4-1/+7
Extend the "common/include order" test to ensure that the build directory is preferred over the source directory. For example, when using `configure_file()`, the resulting file should be preferred over a file with the same name in the source directory.
2023-03-28test cases: make various things werror-safeEli Schwartz4-4/+9
Allows getting closer to `./run_project_tests.py -- -Dwerror=true`. - when argc and argv are not *both* used, there's a standard, compliant mechanism to mark the variable as unused - generated code should not build as -Werror - more thoroughly comment out some commented code
2023-03-28backends: fix bug where meson_exe crashed if constructed with found programsEli Schwartz2-1/+1
Because we base the pickled data name on the name property of the command being run... and for built targets, `exe.name` is always just the name. However, for an ExternalProgram this is just whatever string we searched for, so, NOT just the basename. This became a bigger issue once we started using generator() with the actual program in commit 6aeec808367f05463394e30a8d40834e97c7afc0, rather than first casting it to a string, because the VS backend *always* uses the meson_exe approach for various reasons related to VS being VS. Outside of that, it's difficult to actually get an ExternalProgram object passed to meson_exe -- CustomTarget lowers it to a string, capture is handled via argparse instead of pickling, etc. Fixes #11593
2023-03-27custom_target: libfoo.so.1 is linkableXavier Claessens1-1/+8
2023-03-11Make generator exe more resilient.Jussi Pakkanen1-2/+10
2023-03-09tests: allow a long test to have more time to complete before timing outEli Schwartz1-2/+2
This test is intended to test really long output, so it prints 100k lines of stdout/stderr. It completes in two seconds on my machine, but the default 30-second timeout is apparently too much for CI, because on Windows we often get flaky tests due to this. e.g. we'll get within 200 lines of the end. Bump the CI time by x2. We know this isn't particularly surprising behavior, and allowing it to request another 30 seconds won't hang the CI. But it will save us from some spurious failures and restarted jobs.
2023-03-09re-deduplicate feature warnings printed at the end of setupEli Schwartz1-1/+1
In commit eaf365cb3ef4f1c2ba66e07237d86a44089aff4f we explicitly sorted them for neatness, with the rationale that we were restoring intentional behavior and we only need a set for stylistic purposes. This actually wasn't true, because we never sorted them to begin with (we did sort the version numbers), but sorting them is fine. The bigger issue is that we actually used a set to avoid printing the same feature type multiple times. Now we do print them multiple times -- because each registered feature includes the unique node. Fix this by using both sorted and a set. Fix tests that should in retrospect have flagged this as an issue, but were added later on in the same series to check something else entirely, happen to cover this too, and were presumably copied directly from stdout as-is...
2023-03-04typed_kwargs: Extend since_values and deprecated_values for typesXavier Claessens1-1/+1
2023-03-01interpreter: report FeatureNew for kwargs to project()Eli Schwartz2-1/+9
We need to know the project minimum version before evaluating the rest of the function. There's three basic approaches: - try to set it inside KwargInfo - just run a minimal version of func_project for this, then load everything after - drop down to the AST and set it before anything else In order to handle FeatureNew emitted by a FunctionNode evaluated before project() due to being inlined, such as `version: run_command()`, only option 3 suffices, the rest all happen way too late. Since we have just added AST handling support for erroring out, we can do that to set the version as well.