summaryrefslogtreecommitdiffstats
path: root/testing
Commit message (Collapse)AuthorAgeFilesLines
* post releaseWilliam Deegan2025-03-021-1/+1
|
* Framework: fixture methods now handle lists for dstdirMats Wichmann2025-02-281-0/+5
| | | | | | | | | | | | | TestCmd.dir_fixture and TestCmd.file_fixture are described as accepting a list for both srcdir and dstdir. For example, the docstring for `dir_fixture`: srcdir or dstdir may be a list, in which case the elements are first joined into a pathname. However, the implementation only handled this for srcdir/srcfile. Added the same stanza for dstdir/dstfile.. Signed-off-by: Mats Wichmann <mats@linux.com>
* Fix running individual test files when ninja is not installedAdam Simpkins2025-02-231-1/+8
| | | | | | | | | | | | | The code in testing/framework/TestSCons.py attempted to handle an ImportError if ninja is not available. However, when running individual test files from the scons/test/ directory, this directory is included as the first entry in sys.path. When this happens, the `import ninja` statement succeeds, finding the scons/test/ninja/ directory and treating it as a package. This results in an AttributeError being thrown later attempting to access `ninja.BIN_DIR`, rather than an ImportError. I have confirmed that this change now allows `./runtest.py test/Help.py` to succeed, even when ninja is not installed.
* Rework a TestCommon test to look less ugly [skip appveyor[Mats Wichmann2024-12-291-13/+13
| | | | | | | | | Insted of really long strings of repeated characters, use f-strings to compose the "expected" output for the banner function tests. This keeps the code formatter from breaking things an ugly way, and is really more "accurate" anyway. Signed-off-by: Mats Wichmann <mats@linux.com>
* test framework: bulk reformatMats Wichmann2024-12-2911-1280/+1865
| | | | | | Imcludes test snippets contained in docstrings, too. Signed-off-by: Mats Wichmann <mats@linux.com>
* Modernize stat usageMats Wichmann2024-12-154-27/+27
| | | | | | | | | | | Since Python 2.2, the object returned by an os.stat() call presents attributes matching the 10-tuple of stat values. Use these instead of indexing into the tuple. As usual for non-removed tests, minor tweaks made if needed - copyright header and DefautlEnvironment() call for performance. Signed-off-by: Mats Wichmann <mats@linux.com>
* updated so TestSCons.NINJA_BINARY is set and used by all such testsWilliam Deegan2024-11-252-10/+11
|
* Fixed ninja binary location logic to use ninja.BIN_DIR. Previous logic no ↵William Deegan2024-11-251-59/+87
| | | | longer works starting with python ninja package version 1.11.1.2
* Merge pull request #4642 from Repiteo/remove-python-3.6William Deegan2024-11-161-1/+1
|\ | | | | Remove Python 3.6 support
| * Remove Python 3.6 supportThaddeus Crews2024-11-161-1/+1
| |
* | Integrate `from __future__ import annotations`Thaddeus Crews2024-11-163-35/+40
|/
* Merge branch 'master' into jbrill-msvs-testsJoseph Brill2024-10-281-3/+11
|\ | | | | | | Manually resolve conflicts in CHANGES.txt.
| * Move IS_ROOT definition to frameworkMats Wichmann2024-10-191-0/+4
| | | | | | | | Signed-off-by: Mats Wichmann <mats@linux.com>
| * Adjust tests in case running as rootMats Wichmann2024-10-191-3/+7
| | | | | | | | | | | | | | | | | | | | | | Although validation tests are not normally run as root, there may be cicrumstances when it happens - one known case is when the test suite is run as part of a particular Linux distros package construction. It isn't too hard to avoid the few places where we counted on something failing because of permissions, which don't if the user is root - added a few skips. Signed-off-by: Mats Wichmann <mats@linux.com>
* | Add optional keyword argument auto_filter_projects to MSVSSolution.Joseph Brill2024-10-281-8/+72
| | | | | | | | | | | | | | Changes: * Detect solution file names and nodes in projects argument list. Behavior based on the auto_filter_projects value. By default, raise an exception. * Update TestSConsMSVS and multiple project auto_build_solution tests. * Update documentation, CHANGES.txt, and RELEASE.txt.
* | Remove win32 platform specification (i.e., platform = 'win32') from MSVS ↵Joseph Brill2024-10-191-7/+7
| | | | | | | | test Environments.
* | Remove MSVSProject argument projectguid and replace with MSVS_PROJECT_GUID ↵Joseph Brill2024-10-131-5/+5
| | | | | | | | in all test files.
* | Update Tool/msvs.py, update MSVS tests; and add additional tests for MSVS ↵Joseph Brill2024-10-111-19/+250
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | multi-project and solution builds. Tool/msvs.py: * Add "projectguid" argument to MSVSProject to enable user-defined GUID assignment per-project for multiple project solutions. * Project GUID priority: (1) MSVSProject "projectguid" argument, (2) SCons env MSVS_PROJECT_GUID value, (3) internally generated GUID. SCons env MSVS_PROJECT_GUID value should not be used for multiple project solutions without using projectguid arguments (otherwise, multiple projects will use the same GUID). * Store the project GUID as a node Tag when generating the MSVSProject and retrieve the project GUIDs using GetTag when generating the solution. * Move project node processing to a function so it can be called from multiple code locations. * Filter out solution nodes from project list (bugfix: auto_build_solution enabled and returned value used as project list includes auto-generated solution as a Project in the solution file). * Check for variant directory build of MSVSSolution and adjust src node accordingly similar to MSVSProject code. Bug fix: the solution file is generated in the build directory instead of the source directory. The placeholder solution file is now generated in the build directory and the solution file is generated in the source folder similar to the handling of project files. * Add project dsp nodes to the dsw source node list. This appears to always cause the project files to be generated before the solution files which is necessary to retrieve the project GUIDs for use in the solution file. This does change the behavior of clean for a project generated with auto_build_solution disabled and explicit solution generation: when the solution file is cleaned, the project files are also cleaned. The tests for vs 6.0-7.1 were changed accordingly. testing/framework/TestSConsMSVS.py: * Add known project GUID for single project tests and two known project GUIDs for dual project tests. * Add projectguid to MSVSProject arguments for single project test SConstruct/SConscript files. * Add PROJECT_BASENAME replaceable field to expected generated project file templates. * Add dual project and single solution templates. Tests: * Use known project guid for most tests which prevents have to hard-code generated GUIDs. * Add 4 (2x2) tests using two projects for combinations of auto_build_solutions settings (2) and variant directories (2). * Add 2 tests using two projects which use default GUID generation with and without variant directories.
* | Fix MSVS tests and minor changes to Tool/msvs.py.Joseph Brill2024-10-071-5/+27
|/ | | | | | | | | | | | | | | | | | | | | | | | testing/framework/TestSConsMSVS.py: * Add default project GUID * Pass MSVS_PROJECT_GUID via environment * Add AdditionalOptions Condition to expected vcx project file * Fix vs version number for vc version 14.3 * Fix expected platform toolset version SCons/Tool/msvs.py: * User environment MSVS_PROJECT_GUID when creating project files info * Fix writing Visual Studio 15 for VS2015 * Add .vcxprof as an expected suffix for assigning the name to the file base name Fix early exit after vc version 8.0 (exit at the end of first loop execution) in: * test/MSVS/vs-files.py * test/MSVS/vs-scc-files.py * test/MSVS/vs-scc-legacy-files.py * test/MSVS/vs-variant_dir.py Tests: * Modify tests using TestSConsMSVS to add MSVS_PROJECT_GUID to the environment in the generated SConstruct/SConscript files. * Fix: delete env['PYTHON_ROOT'] before next loop iteration in test/MSVS/vs-files.py.
* Some tweaks to testing framework.Mats Wichmann2024-09-105-206/+337
| | | | | | | | | | | | | | | | | | | | | | | Most interesting is an "api change" - the test methods test.must_exist() and test.must_exist_one_of() now take an optional 'message' keyword argument which is passed on to fail_test() if the test fails. The regex used to test an exception is now working for Python 3.13, and enabled conditionally - the "enhanced error reporting" changed, in a way that made it easy to reuse the existing regex (if somebody wants to take a shot at unifying them, more power!). Also one unexpected issue was found - one of the check routines does "output = os.newline.join(output)", but there is no os.newline. Could use os.linesep, but just changed it to the Python newline character. Some annotations added, and some cleanup done on possibly unsafe uses - mainly that self.stderr() and selt.stdout() *can* return None, but several places in the code just did string operations on the return unconditionally. There's already precendent- other places did do a check before using, so just extended the concept to possibly vulnerable palces. Signed-off-by: Mats Wichmann <mats@linux.com>
* put master branch back in develop modeWilliam Deegan2024-09-041-1/+1
|
* Variables testing: confirm space-containing valuesMats Wichmann2024-08-273-10/+22
| | | | | | | | | | | | | The previous commit introduced a change to how the framework handled arguments, which necessitated some changes in the variables code. It got too complicated, too many places would need too much logic. Just accept that the test.run(arguments="...") will never be quite like the same arguments on the CLI, and just use lists to avoid things being broken on embedded spaces - those won't be split. Many tests arleady do this, so it's nothing new. Added a comment in TestCmd to make it more clear. Signed-off-by: Mats Wichmann <mats@linux.com>
* Fix ListVariable with a space-containing valueMats Wichmann2024-08-162-19/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix ListVariable handling of a quoted variable value containing spaces. As a side effect of splitting the former monolithic converter/validator for ListVariable into separate callbacks, it became possible for subst to be called twice. The ListVariable converter produces an instance of a _ListVariable container, and running subst on that result ends up losing information, so avoid doing so. While developing a test for this, it turned out the test framework also didn't handle a quoted argument containing a space, so that a test case passing arguments to scons via "run(arguments='...')" could end up with scons seeing a different (broken) command line than scons invoked with the same arguments typing to a shell prompt. A regex is now used to more accurately split the "arguments" parameter, and a unit test was added to the framework tests to validate. The framework fix had a side effect - it was possible that when run as part of the test suite, the Variables package could receive a value still wrapped in quotes, leading to string mismatches ('"with space"' is not equal to 'with space'), so ListVariable now strips wrapping quote marks. Also during testing it turned out that the earlier fix for #4241, allowing a Variable to declare the value should not be subst'd, introduced problems for two types which assumed they would always be passed a string. With subst=False, they could be passed a default value that had been specified as a bool. Fixed to not fail on that. Fixes #4585 Signed-off-by: Mats Wichmann <mats@linux.com>
* Return master to development mode post releaseWilliam Deegan2024-07-081-2/+2
|
* Some minor test tweakingMats Wichmann2024-07-062-6/+10
| | | | | | | | Don't """code block""" % locals() if there's not actually a substitution in the code block. While there, fix any old-style file headers, and add a DefaultEnvironment call if not present. Signed-off-by: Mats Wichmann <mats@linux.com>
* Merge branch 'master' into jbrill-msvc-detectJoseph Brill2024-05-281-1/+6
|\
| * Fix two scons-time tests on GH Windows runnerMats Wichmann2024-05-261-1/+6
| | | | | | | | Signed-off-by: Mats Wichmann <mats@linux.com>
* | Merge branch 'master' into jbrill-msvc-detectJoseph Brill2024-05-181-29/+15
|\ \ | |/
| * scons-time: add filter to tarfile extract call.Mats Wichmann2024-05-131-29/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Python 3.13.0b1 added a warning when the extraction filter is not specified. The filter aregument (to extract() and extractall()) was added in 3.12, but with no noise. Once the warning was added, the scons-time tests began to fail - this is a continuation of the work Red Hat did for RHEL 8 and RHEL 9 starting with Python 3.9. Supplying the filter quiets the warning, which also worked for the RHEL case. The tarfile and zipfile usage now uses a context manager (both objects can be used this way since Python 3.2 or so). Signed-off-by: Mats Wichmann <mats@linux.com>
* | Merge branch 'master' into jbrill-msvc-detectJoseph Brill2024-05-146-49/+79
|\ \ | |/ | | | | | | | | | | Manually resolved conflicts: * CHANGES.txt * RELEASE.txt * test/MSVS/vs-14.3-exec.py
| * Fix a few typos in test doc [ci skip]Mats Wichmann2024-05-111-14/+15
| | | | | | | | | | | | | | | | | | | | Several typos found by PyCharm spellchecking Changed style of document heading Changed a couple of words elsewhere. No substantive changes this time. Signed-off-by: Mats Wichmann <mats@linux.com>
| * Merge pull request #4519 from mwichmann/py36-deprWilliam Deegan2024-05-101-3/+3
| |\ | | | | | | Deprecate Python 3.6 support.
| | * Merge branch 'master' into py36-deprWilliam Deegan2024-05-104-20/+59
| | |\
| | * | Deprecate Python 3.6 support.Mats Wichmann2024-05-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | No claim is made about when it will actually be dropped, but some notice seems polite. Signed-off-by: Mats Wichmann <mats@linux.com>
| * | | Maintenance: Python version usageMats Wichmann2024-05-102-12/+2
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Simplify/clarify some usage of Python version strings. Dropped a couple which refer to unsupported versions. While looking at version usage, it became clear one of the SWIG tests wasn't doing the right thing - it has a special case for Windows, where the way the path to the Python library is constructed would only work for the python.org release, not the Store version. Since we compute this information correclty in the test framework, and the test already called that routine - before ignoring the results - just use that instead. Though it turns out the framework didn't quite do the right thing either, returning a bare lib name without the library suffix - fixed that, too. Signed-off-by: Mats Wichmann <mats@linux.com>
| * | Back off test framework exception handlingMats Wichmann2024-04-014-23/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The try block in TestCmd.start() is removed, it interferes with other things. TestCommon.start is supposed to handle exceptions, so inserting more stuff at a lower level (parent class) made a mess of the framework tests. Clean up a complaint with later Pythons (3.12+), and include (incomplete) new regex for Python 3.13+. Signed-off-by: Mats Wichmann <mats@linux.com>
| * | Testing framework fixesMats Wichmann2024-04-011-22/+37
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Test framework now reports a FAIL if the subprocess call to run the test was aborted by the operating system (this is particularly for Windows when antivirus could reject running a compiled test binary). Previously these failures were not recorded in the fails list and so were easy to miss. - Test framework now uses a subdirectory named "scons" below the base temporary directory. This gives something invariant to tell antivirus software to ignore without having to exclude the tmpdir itself. - MSVS "live" tests of project files (e.g. test/MSVS/vs-14.3-exec.py) adjusted to look for the generated executable with an exe sufffix. This had recently started failing on the line:: test.run(program=test.workpath('sub dir', 'foo'), stdout="foo.c\n") as somehow "sub dir\foo" was created, and then "foo.exe" was not matched causing the binary not to execute and failing the test. Signed-off-by: Mats Wichmann <mats@linux.com>
* | Merge branch 'master' into jbrill-msvc-detectJoseph Brill2024-03-231-3/+3
|\ \ | |/ | | | | | | | | Manually resolved: * CHANGES.txt * RELEASE.txt
| * Fix a Python 3.13 problem in re.sub usageMats Wichmann2024-03-211-2/+2
| | | | | | | | | | | | | | | | | | re.sub's count and flags arguments are transitioning to keyword-only. With 3.13a5, usage as positional args issues a DeprecationWarning, which caused one SCons test to fail. Updated in test framework and in bin/update-release-info.py. Signed-off-by: Mats Wichmann <mats@linux.com>
| * Put master back in post release/develop modeWilliam Deegan2024-03-181-1/+1
| |
| * Add unlink_files method tests to TestCmdTests.py.Joseph Brill2023-12-291-0/+97
| |
| * Add unlink_files method to TestCmd, replace file deletion loops with method ↵Joseph Brill2023-12-281-0/+25
| | | | | | | | calls in msvs executable test scripts, re-order CHANGES.txt.
| * post release updatesWilliam Deegan2023-11-201-1/+1
| |
| * Elminate http: referencesMats Wichmann2023-10-172-2/+2
| | | | | | | | | | | | | | | | | | | | Most remaining http: references are either changed to https: or removed or changed in case they were also stale links, and a replacement was findable. Does not affect schema and stylesheet references, which can remain http: Signed-off-by: Mats Wichmann <mats@linux.com>
| * Fixup one test framework test [skip appveyor]Mats Wichmann2023-10-061-7/+6
| | | | | | | | | | | | Looking at wrong exceptions for possible rmdir failures Signed-off-by: Mats Wichmann <mats@linux.com>
* | Detection changes for VS IDE editions and VS2008 (develop and vcforpython).Joseph Brill2024-03-121-3/+3
| | | | | | | | | | | | | | | | Changes: * An express installation of the IDE binary is used when no other IDE edition is detected. * A full development edition (e.g., Professional) of VS2008 is elected before a Visual C++ For Python edition. * Update detection order in README.rst and remove hard tabs. * Minor fixes lingering from original VSWHERE implementation where all call chains were not updated when the environment argument was added.
* | Merge branch 'master' into HEADJoseph Brill2024-01-074-10/+131
|/ | | | | | | Manually resolve conflicts: * CHANGES.txt * RELEASE.txt * SCons/Tool/MSCommon/vc.py
* More conversions: {repr(var)} -> {var!r}Mats Wichmann2023-08-042-10/+10
| | | | | | | Some of these got done in the tool conversion, some not, so picked up the rest manually. Signed-off-by: Mats Wichmann <mats@linux.com>
* "Modernize" to Python 3.6 via toolMats Wichmann2023-08-043-5/+4
| | | | | | | | | | | | | | | | | | | | | $ pyupgrade --py36-plus $(<filelist) Here's mostly what it's done: - No more 'stringliteral'.encode('utf-8'): now b'stringliteral' - No more unicode literals - the default open mode is 'r', leaves out if default - some f-string conversions (if shorter) - catch OSError instead of subclasses - no more mention of "object" - generator expression instead of list comp. when safe - a few tests had a shebang but actually began with blank line - remove coding: utf-8 comment, per pep 3120 this is the default now Manually - if a file in test/ was modified, then did the copyright header conversion. Signed-off-by: Mats Wichmann <mats@linux.com>
* test framework doc: fix review comments [ci skip]Mats Wichmann2023-07-211-9/+3
| | | | Signed-off-by: Mats Wichmann <mats@linux.com>