summaryrefslogtreecommitdiffstats
path: root/testing/framework/TestSCons.py
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* test framework: bulk reformatMats Wichmann2024-12-291-240/+379
| | | | | | Imcludes test snippets contained in docstrings, too. Signed-off-by: Mats Wichmann <mats@linux.com>
* updated so TestSCons.NINJA_BINARY is set and used by all such testsWilliam Deegan2024-11-251-10/+8
|
* 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-161-3/+4
|/
* Some tweaks to testing framework.Mats Wichmann2024-09-101-22/+47
| | | | | | | | | | | | | | | | | | | | | | | 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
|
* Return master to development mode post releaseWilliam Deegan2024-07-081-2/+2
|
* Some minor test tweakingMats Wichmann2024-07-061-2/+2
| | | | | | | | 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 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-101-2/+2
| |\
| * | 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-101-9/+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-011-2/+2
|/ | | | | | | | | | | | 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>
* 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
|
* post release updatesWilliam Deegan2023-11-201-1/+1
|
* "Modernize" to Python 3.6 via toolMats Wichmann2023-08-041-1/+1
| | | | | | | | | | | | | | | | | | | | | $ 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>
* Add some cheap return and parameter annotationsMats Wichmann2023-05-011-37/+37
| | | | | | | | | | | | | | | | | Use: https://github.com/JelleZijlstra/autotyping to add "safe" return annotations. Where a parameter has a default value that is an obvious scalar type (bool, int, str, etc.) add those annotations as well. Also fixed two small bugs that popped up when sanity-checking with mypy. One in FortranCommon, where a return had been previously annotated to be a tuple of Action, which should be ActionBase - Action is the factory function, not the base class. The other was a typo in the error raised in _add_cppdefines - the message was formatted with the value of "define" which should have been "defines". Signed-off-by: Mats Wichmann <mats@linux.com>
* Updates post 4.5.2 releaseWilliam Deegan2023-03-211-1/+1
|
* Post release changesWilliam Deegan2023-03-071-1/+1
|
* Post release UpdatesWilliam Deegan2023-03-051-1/+1
|
* moved the qt tool to qt3. Changed all QT envvars to be now prefixed with QT3William Deegan2023-02-241-3/+6
|
* move qt -> qt3 tool, adjust testing as wellWilliam Deegan2023-02-231-5/+5
|
* Merge remote-tracking branch 'upstream/master' into ↵William Deegan2023-01-291-82/+93
|\ | | | | | | fix_configure_marking_up_to_date
| * [ci skip] Fix remaining sider complaintsWilliam Deegan2022-11-291-8/+2
| |
| * Use f-strings in framework and framework testsMats Wichmann2022-11-241-63/+63
| | | | | | | | | | | | | | | | | | This is a mostly tool-based conversion (a couple added by hand), and other changes were not made, to try to keep the diff manageable. Adds a GitHub Action to run framework tests if framework changes. Signed-off-by: Mats Wichmann <mats@linux.com>
| * A few more e2e test speedupsMats Wichmann2022-11-161-0/+2
| | | | | | | | | | | | adding DefaultEnvironment calls with no tools Signed-off-by: Mats Wichmann <mats@linux.com>
| * [framewqork] use subprocess timeoutsMats Wichmann2022-08-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Since Python 3.3, the subprocess module has its own timeout implementation, so remove the test framework's custom one. Required a little rejigger since the subprocess timeout is done on the communicate() call, not set up before the test is started. Noted that the framework intends to support two levels: one for the testing class instance, and one for an individual start call, which should override the one in the instance. Signed-off-by: Mats Wichmann <mats@linux.com>
| * Post release cleanup. back to dev modeWilliam Deegan2022-07-301-1/+1
| |
| * Improvements to lex and yacc toolsMats Wichmann2022-06-301-9/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mocked tools mylex.py and myyacc.py now understand the file-generation options, and generate a dummy file with predictable contents, for checking. This allows more testing of the path through the SCons support for these two without needing live commands. New tests added which invoke the file-generation options, and make sure the extra files are created, and that SCons detects and tracks the added targets. Work is done in a subdirectory, which exposes some existing known inconsistent behavior (the regular generated file goes in the subdir per the LEXCOM and YACCOM generated line, while the ones generated from commandline options go in the topdir) - but we're going to allow that behavior to continue for backwards compat. Same fix applied to yacc tool that PR #4168 did for lex - do subst_list() instead of subst() to preserve spaces in paths. That fix left the lex tool unable to pass the new test, as it could not see the individual arguments in the FLAGS variable, which was solved by indexing into the subst'd list so we can iterate over the args again. Test and tool cleanup; add DefaultEnvironment calls, etc. Note this mentions, but does not address the problem described in issue 4154. Signed-off-by: Mats Wichmann <mats@linux.com>
* | Fix for #2757, non conftest nodes involved in configure checks now get node ↵Daniel Moody2022-05-261-2/+2
|/ | | | info cleared after check.
* Skip new content-timestamp-symlink test on win32Mats Wichmann2022-05-061-1/+6
| | | | Signed-off-by: Mats Wichmann <mats@linux.com>
* Use super call instead of direct class callMats Wichmann2022-03-151-2/+2
| | | | | | | | | - super used where direct call to superclass existed - convert a few older-style super() (two-argument) uses - in a few places, where there was an intersection with a super change, variables that override a builtin (e.g. "dict") were renamed. Signed-off-by: Mats Wichmann <mats@linux.com>
* Merge pull request #4067 from mwichmann/wintweaksWilliam Deegan2021-11-261-2/+0
|\ | | | | Fix tests to not hang on Windows with bad .py assoc
| * Fix tests to not hang on Windows with bad .py assocMats Wichmann2021-11-261-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For systems where the association for .py files is not to an actual Python interpreter, those few cases where we need to run a Python script directly as a program don't work. This could be because the association was never set up, or because some other program (e.g. Visual Studio Code) has taken it over. In some cases may appear to "hang" because the alternate program is waiting for user interaction runtest.py now has a mechanism to check (thanks to Brett Cannon for providing this incantation). It isn't super precise (looks for the substring "py" in the queried association), but should work out. It sets an environment variable which the test framework can read and as a result set a flag which individual tests can read. Two tests in scons-time which had previously been set to skip-if-win32 now look at this flag instead. Three tests in sconsign now also look at this flag. This allows a clean run on my dev box with VS Code having taken over the .py association. Various things can break if the environment used to fire off Windows processes doesn't contain %UserProfile%. Added this to the short list of passthrough env vars. Apparently an environment without this value is now considered invalid (it blew up the erroneously launched VS Code, but we've apparently been lucky it hasn't blown up more things - believe there was also a report of a problem with the Visual Studio setup scripts). A little extra cleanup: - a couple of Py2-isms were cleaned out (Script/Main.py and in the test framework) - The paths to look for site-scons were rewritten (part of this was another Py2-ism), and the system path changed a bit - the old path is still checked, and the manpage updated to reflect this. - runtest.py dropped the unused whereis functions. - the three sconsign tests now use f-string formatting, mostly as an experiment to see how easy it is to convert. Fixes #4053 Signed-off-by: Mats Wichmann <mats@linux.com>
* | fix some issues with current version stringsWilliam Deegan2021-11-221-1/+1
|/
* Update post release changesWilliam Deegan2021-11-221-1/+1
|
* Tests pass in python 3.6 and 3.9 in LinuxJacob Cassagnol2021-11-091-0/+22
| | | | | | | | | | | | | | | Modified failing tests to use the new defaulted .sconsign database based on the hash algorithm For MD5, default database will be .sconsign.dblite For other algorithms the default will be .sconsign_<hashname>.dblite. For all cases where the user changes the hash algorithm used, the database will be .sconsign_<hashname>.dblite (including md5) For sub-scons directories it remains as .sconsign Also added unit-tests for Util.py for the new hash default changes. It's difficult to setup a fips-compliant platform using containers, and instead we mock that. option--config uses multiple types of hash algorithms so was skipped. Removed one f-string (python 3.5 doesn't support those) Corrupt.py is using an explicit .sconsign so that was left as-is, and only the parent default .sconsign was changed for work test 1. A fetch-database name option was added to the testing framework. The unlink_sconsignfile was not updated as no usages of it were found.
* Half the failing testcases fixed.Jacob Cassagnol2021-11-011-3/+3
| | | | | | | | | | | | | | Still failing on: SCons/UtilTests.py test/Configure/ConfigureDryRunError.py test/Configure/implicit-cache.py test/Configure/option--config.py test/option/hash-format.py test/option/option-n.py test/question/Configure.py These tests all have hardcoded md5 sums or use md5 directly Next commit should fix it so the md5-specific tests are skipped if fips mode detected. Also will figure out a way around the hardcoded m5sums.
* Updated the Mac-specific Java check in test fwMats Wichmann2021-08-251-38/+56
| | | | | | | | There is a new stub java/javac/jar/java_home on the Mac, probably after the Oracle license change to Java (though that part is only a guess). Updated the detection code to handle the new way. Signed-off-by: Mats Wichmann <mats@linux.com>
* Post 4.2.0 merge/reset to development modeWilliam Deegan2021-08-011-3/+3
|
* Fix sider warning typo and docstring for skip_if_not_msvcMats Wichmann2021-04-131-1/+1
| | | | Signed-off-by: Mats Wichmann <mats@linux.com>
* Test harness add a from_fw to skip callsMats Wichmann2021-04-131-134/+143
| | | | | | | | | | | | | | | | | | Main functional change is a new kwarg to skip_test() to allow calls from inside the framework to skip an additional line of traceback in the skip output - i.e. don't just skip the entry for skip_test, but also the function in the fw that called it. Other functional change is for the try block in skip_if_not_msvc() (which is one of the internal callers of skip_test() mentioned for the other change) to catch Exception, thus avoiding system-existing exceptions that were caught by the existing bare except, which caused the skip to not actually skip. The remainder of the patch is docstring reformatting, some minor code reformats, top-of-file license blocks, etc. Signed-off-by: Mats Wichmann <mats@linux.com>
* Deprecate Python 3.5.Mats Wichmann2021-03-281-1/+1
| | | | Signed-off-by: Mats Wichmann <mats@linux.com>
* Add timing of sconsign write if --debugMats Wichmann2021-02-081-2/+2
| | | | | | | | | | | A line is now emitted showing sconsign sync time if --debug=time Some calls to time.time replaced with time.perf_counter, where the objective was to time sections of code (i.e. where there wasn't an actual need to get time-since-epoch) - Python recommends this as getting the best-available timer. Signed-off-by: Mats Wichmann <mats@linux.com>
* [ci skip] update post releaseWilliam Deegan2021-01-191-1/+1
|
* feat: Adds ZIP_OVERRIDE_TIMESTAMPDavid H2021-01-181-3/+33
|