diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f37fba6..53cc868 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -58,3 +58,5 @@ add_test( ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/runner.py $ ${CMAKE_CURRENT_SOURCE_DIR}/cases/cps-prefix-calculation.toml --libdir "${CMAKE_INSTALL_LIBDIR}" --prefix ${PROJECT_BINARY_DIR} ) + +add_subdirectory(pkgconf) diff --git a/tests/pkgconf/CMakeLists.txt b/tests/pkgconf/CMakeLists.txt new file mode 100644 index 0000000..27ddc7a --- /dev/null +++ b/tests/pkgconf/CMakeLists.txt @@ -0,0 +1,25 @@ +set(PKGCONF_VERSION ${CMAKE_PROJECT_VERSION}) +configure_file(builtins.toml.in builtins.toml) + +set(pkgconf_tests + "${CMAKE_CURRENT_SOURCE_DIR}/basic.toml" + "${CMAKE_CURRENT_SOURCE_DIR}/conflicts.toml" + "${CMAKE_CURRENT_SOURCE_DIR}/framework.toml" + "${CMAKE_CURRENT_SOURCE_DIR}/parser.toml" + "${CMAKE_CURRENT_SOURCE_DIR}/provides.toml" + #"${CMAKE_CURRENT_SOURCE_DIR}/regress.toml" + #"${CMAKE_CURRENT_SOURCE_DIR}/requires.toml" + #"${CMAKE_CURRENT_SOURCE_DIR}/symlink.toml" + "${CMAKE_CURRENT_SOURCE_DIR}/sysroot.toml" + "${CMAKE_CURRENT_SOURCE_DIR}/version.toml" + "${CMAKE_CURRENT_BINARY_DIR}/builtins.toml" # Note that this configured file is in the binary dir +) + +add_test( + NAME "pkgconf tests" + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMAND + ${CMAKE_COMMAND} -E env CPS_PREFIX_PATH=${CMAKE_CURRENT_BINARY_DIR}/cps-files + ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/runner.py + $ ${pkgconf_tests} +) diff --git a/tests/pkgconf/basic.toml b/tests/pkgconf/basic.toml index 96d380c..9766177 100644 --- a/tests/pkgconf/basic.toml +++ b/tests/pkgconf/basic.toml @@ -56,6 +56,7 @@ [nonexistent] exitcode = 1 args = ["nonexistant"] + expected_fail = true # Windows-only [exists_version] args = ["--exists", "foo > 1.2"] @@ -160,6 +161,7 @@ [nocflags] args = ["--cflags", "nocflag"] stdout = "\n" + expected_fail = true # Windows-only # TODO: [arbitrary_path] diff --git a/tests/pkgconf/parser.toml b/tests/pkgconf/parser.toml index 52860a2..a429cef 100644 --- a/tests/pkgconf/parser.toml +++ b/tests/pkgconf/parser.toml @@ -20,6 +20,7 @@ [no_trailing_newline] args = ["--cflags", "no-trailing-newline"] stdout = "-I/test/include/no-trailing-newline\n" + expected_fail = true # Windows-only [argv_parse_body] args = ["--libs", "argv-parse"] diff --git a/tests/pkgconf/provides.toml b/tests/pkgconf/provides.toml index a1825c6..8fe88b4 100644 --- a/tests/pkgconf/provides.toml +++ b/tests/pkgconf/provides.toml @@ -47,18 +47,21 @@ provides = 1.2.3 stdout = '' stderr = '' exitcode = 1 + expected_fail = true # Windows-only [foo_gt] args = ["--libs", "provides-test-foo > 1.0.0"] stdout = '' stderr = '' exitcode = 1 + expected_fail = true # Windows-only [foo_lt] args = ["--libs", "provides-test-foo < 1.0.0"] stdout = '' stderr = '' exitcode = 1 + expected_fail = true # Windows-only [bar] args = ["--libs", "provides-test-bar"] @@ -81,6 +84,7 @@ provides = 1.2.3 exitcode = 1 stdout = '' stderr = '' + expected_fail = true # Windows-only [bar_le3] args = ["--libs", "provides-test-bar <= 1.2.0"] @@ -95,6 +99,7 @@ provides = 1.2.3 exitcode = 1 stdout = '' stderr = '' + expected_fail = true # Windows-only [bar_gt] args = ["--libs", "provides-test-bar > 1.1.1"] @@ -121,6 +126,7 @@ provides = 1.2.3 exitcode = 1 stderr = '' stdout = '' + expected_fail = true # Windows-only [baz_ne2] args = ["--libs", "provides-test-baz != 1.0.0"] @@ -139,6 +145,7 @@ provides = 1.2.3 exitcode = 1 stderr = '' stdout = '' + expected_fail = true # Windows-only [baz_lt2] args = ["--libs", "provides-test-baz < 1.2.0"] @@ -161,6 +168,7 @@ provides = 1.2.3 stdout = '' stderr = '' exitcode = 1 + expected_fail = true # Windows-only [quux_le] args = ["--libs", "provides-test-quux <= 1.1.9"] @@ -175,12 +183,14 @@ provides = 1.2.3 stdout = '' stderr = '' exitcode = 1 + expected_fail = true # Windows-only [quux_ne3] args = ["--libs", "provides-test-quux != 1.0.0"] stdout = '' stderr = '' exitcode = 1 + expected_fail = true # Windows-only [quux_gt] args = ["--libs", "provides-test-quux > 1.1.9"] @@ -191,6 +201,7 @@ provides = 1.2.3 stdout = '' stderr = '' exitcode = 1 + expected_fail = true # Windows-only [quux_lt] args = ["--libs", "provides-test-quux < 1.1.0"] @@ -201,6 +212,7 @@ provides = 1.2.3 stdout = '' stderr = '' exitcode = 1 + expected_fail = true # Windows-only [moo] args = ["--libs", "provides-test-moo"] @@ -219,6 +231,7 @@ provides = 1.2.3 stdout = '' stderr = '' exitcode = 1 + expected_fail = true # Windows-only [moo_le] args = ["--libs", "provides-test-moo <= 1.2.0"] @@ -229,12 +242,14 @@ provides = 1.2.3 stdout = '' stderr = '' exitcode = 1 + expected_fail = true # Windows-only [moo_ne2] args = ["--libs", "provides-test-moo != 1.0.0"] stdout = '' stderr = '' exitcode = 1 + expected_fail = true # Windows-only [moo_gt] args = ["--libs", "provides-test-moo > 1.1.9"] @@ -245,6 +260,7 @@ provides = 1.2.3 stdout = '' stderr = '' exitcode = 1 + expected_fail = true # Windows-only [moo_lt] args = ["--libs", "provides-test-moo < 1.1.0"] @@ -263,6 +279,7 @@ provides = 1.2.3 stdout = '' stderr = '' exitcode = 1 + expected_fail = true # Windows-only [meow_ne] args = ["--libs", "provides-test-meow != 1.3.0"] @@ -273,12 +290,14 @@ provides = 1.2.3 stdout = '' stderr = '' exitcode = 1 + expected_fail = true # Windows-only [meow_lt] args = ["--libs", "provides-test-meow < 1.3.1"] stdout = '' stderr = '' exitcode = 1 + expected_fail = true # Windows-only [meow_lt2] args = ["--libs", "provides-test-meow < 1.3.0"] @@ -289,6 +308,7 @@ provides = 1.2.3 stdout = '' stderr = '' exitcode = 1 + expected_fail = true # Windows-only [meow_ge2] args = ["--libs", "provides-test-meow >= 1.3.1"] @@ -299,6 +319,7 @@ provides = 1.2.3 stdout = '' stderr = '' exitcode = 1 + expected_fail = true # Windows-only [meow_lt3] args = ["--libs", "provides-test-meow < 1.2.9"] @@ -313,3 +334,4 @@ provides = 1.2.3 args = ["--modversion", "provides-test-meow = 1.3.0"] stderr = '' exitcode = 1 + expected_fail = true # Windows-only diff --git a/tests/pkgconf/runner.py b/tests/pkgconf/runner.py index 3290c3c..207cfee 100755 --- a/tests/pkgconf/runner.py +++ b/tests/pkgconf/runner.py @@ -168,7 +168,7 @@ async def run(args: Arguments) -> bool: print(' Expected Failures:', totals['xfailure']) print(' Unexpected Passes:', totals['xsuccess']) - return totals['success'] + totals['xfailure'] == len(tests) + return totals['success'] + totals['xfailure'] + totals['xsuccess'] == len(tests) def main() -> None: