diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-02-13 00:15:15 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-02-27 16:02:58 +0000 |
commit | 8c04d6c967b33a311fe17e69e9c5e2289a2fcd14 (patch) | |
tree | 25641dc6019707677774ebcde23c92027d788446 /util/cmake/tests | |
parent | 35f23a3dad20e09bada4e8fcdcc0de16b8a6af2f (diff) |
CMake: pro2cmake.py: Improve condition simplification code
Improve the code that simplifies conditions to take "OS families"
into account. E.g. if a system must be ANDROID, then it is redundant
to express that it is NOT APPLE_OSX.
Change-Id: Ib7e62726c309bf84b9e5e0d6a6e3465511db0ead
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Diffstat (limited to 'util/cmake/tests')
-rwxr-xr-x | util/cmake/tests/test_logic_mapping.py | 21 | ||||
-rwxr-xr-x | util/cmake/tests/test_scope_handling.py | 4 |
2 files changed, 23 insertions, 2 deletions
diff --git a/util/cmake/tests/test_logic_mapping.py b/util/cmake/tests/test_logic_mapping.py index cf7913a6e4..c477aa8351 100755 --- a/util/cmake/tests/test_logic_mapping.py +++ b/util/cmake/tests/test_logic_mapping.py @@ -47,6 +47,14 @@ def test_simplify_off(): validate_simplify_unchanged('OFF') +def test_simplify_not_on(): + validate_simplify('NOT ON', 'OFF') + + +def test_simplify_not_off(): + validate_simplify('NOT OFF', 'ON') + + def test_simplify_isEmpty(): validate_simplify_unchanged('isEmpty(foo)') @@ -99,11 +107,19 @@ def test_simplify_unix_and_win32(): validate_simplify('WIN32 AND UNIX', 'OFF') +def test_simplify_unix_or_win32(): + validate_simplify('WIN32 OR UNIX', 'ON') + + def test_simplify_unix_and_win32_or_foobar_or_barfoo(): validate_simplify('WIN32 AND foobar AND UNIX AND barfoo', 'OFF') def test_simplify_watchos_and_win32(): + validate_simplify('APPLE_WATCHOS AND WIN32', 'OFF') + + +def test_simplify_win32_and_watchos(): validate_simplify('WIN32 AND APPLE_WATCHOS', 'OFF') @@ -163,3 +179,8 @@ def test_simplify_complex_false(): validate_simplify('WIN32 AND foobar AND ( ' 'APPLE OR ( UNIX OR FREEBSD ))', 'OFF') + + +def test_simplify_android_not_apple(): + validate_simplify('ANDROID AND NOT ANDROID_EMBEDDED AND NOT APPLE_OSX', + 'ANDROID AND NOT ANDROID_EMBEDDED') diff --git a/util/cmake/tests/test_scope_handling.py b/util/cmake/tests/test_scope_handling.py index 1c3406bac8..8bca8c8ec5 100755 --- a/util/cmake/tests/test_scope_handling.py +++ b/util/cmake/tests/test_scope_handling.py @@ -332,7 +332,7 @@ def test_qstandardpaths_scopes(): assert scope6.total_condition == 'UNIX' assert scope7.total_condition == 'APPLE_OSX' assert scope8.total_condition == 'UNIX AND NOT APPLE_OSX' - assert scope9.total_condition == 'ANDROID AND NOT ANDROID_EMBEDDED AND NOT APPLE_OSX' + assert scope9.total_condition == 'ANDROID AND NOT ANDROID_EMBEDDED' assert scope10.total_condition == 'UNIX AND NOT APPLE_OSX AND (ANDROID_EMBEDDED OR NOT ANDROID)' - assert scope11.total_condition == 'HAIKU AND UNIX AND NOT APPLE_OSX AND (ANDROID_EMBEDDED OR NOT ANDROID)' + assert scope11.total_condition == 'HAIKU AND (ANDROID_EMBEDDED OR NOT ANDROID)' assert scope12.total_condition == 'UNIX AND NOT APPLE_OSX AND NOT HAIKU AND (ANDROID_EMBEDDED OR NOT ANDROID)' |