Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ add_test(
${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/runner.py
$<TARGET_FILE:cps-config> ${CMAKE_CURRENT_SOURCE_DIR}/cases/cps-prefix-calculation.toml --libdir "${CMAKE_INSTALL_LIBDIR}" --prefix ${PROJECT_BINARY_DIR}
)

add_subdirectory(pkgconf)
25 changes: 25 additions & 0 deletions tests/pkgconf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<TARGET_FILE:cps-config> ${pkgconf_tests}
)
2 changes: 2 additions & 0 deletions tests/pkgconf/basic.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
[nonexistent]
exitcode = 1
args = ["nonexistant"]
expected_fail = true # Windows-only

[exists_version]
args = ["--exists", "foo > 1.2"]
Expand Down Expand Up @@ -160,6 +161,7 @@
[nocflags]
args = ["--cflags", "nocflag"]
stdout = "\n"
expected_fail = true # Windows-only

# TODO: [arbitrary_path]

Expand Down
1 change: 1 addition & 0 deletions tests/pkgconf/parser.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
22 changes: 22 additions & 0 deletions tests/pkgconf/provides.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,21 @@ provides = 1.2.3
stdout = '<ignore>'
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only

[foo_gt]
args = ["--libs", "provides-test-foo > 1.0.0"]
stdout = '<ignore>'
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only

[foo_lt]
args = ["--libs", "provides-test-foo < 1.0.0"]
stdout = '<ignore>'
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only

[bar]
args = ["--libs", "provides-test-bar"]
Expand All @@ -81,6 +84,7 @@ provides = 1.2.3
exitcode = 1
stdout = '<ignore>'
stderr = '<ignore>'
expected_fail = true # Windows-only

[bar_le3]
args = ["--libs", "provides-test-bar <= 1.2.0"]
Expand All @@ -95,6 +99,7 @@ provides = 1.2.3
exitcode = 1
stdout = '<ignore>'
stderr = '<ignore>'
expected_fail = true # Windows-only

[bar_gt]
args = ["--libs", "provides-test-bar > 1.1.1"]
Expand All @@ -121,6 +126,7 @@ provides = 1.2.3
exitcode = 1
stderr = '<ignore>'
stdout = '<ignore>'
expected_fail = true # Windows-only

[baz_ne2]
args = ["--libs", "provides-test-baz != 1.0.0"]
Expand All @@ -139,6 +145,7 @@ provides = 1.2.3
exitcode = 1
stderr = '<ignore>'
stdout = '<ignore>'
expected_fail = true # Windows-only

[baz_lt2]
args = ["--libs", "provides-test-baz < 1.2.0"]
Expand All @@ -161,6 +168,7 @@ provides = 1.2.3
stdout = '<ignore>'
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only

[quux_le]
args = ["--libs", "provides-test-quux <= 1.1.9"]
Expand All @@ -175,12 +183,14 @@ provides = 1.2.3
stdout = '<ignore>'
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only

[quux_ne3]
args = ["--libs", "provides-test-quux != 1.0.0"]
stdout = '<ignore>'
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only

[quux_gt]
args = ["--libs", "provides-test-quux > 1.1.9"]
Expand All @@ -191,6 +201,7 @@ provides = 1.2.3
stdout = '<ignore>'
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only

[quux_lt]
args = ["--libs", "provides-test-quux < 1.1.0"]
Expand All @@ -201,6 +212,7 @@ provides = 1.2.3
stdout = '<ignore>'
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only

[moo]
args = ["--libs", "provides-test-moo"]
Expand All @@ -219,6 +231,7 @@ provides = 1.2.3
stdout = '<ignore>'
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only

[moo_le]
args = ["--libs", "provides-test-moo <= 1.2.0"]
Expand All @@ -229,12 +242,14 @@ provides = 1.2.3
stdout = '<ignore>'
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only

[moo_ne2]
args = ["--libs", "provides-test-moo != 1.0.0"]
stdout = '<ignore>'
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only

[moo_gt]
args = ["--libs", "provides-test-moo > 1.1.9"]
Expand All @@ -245,6 +260,7 @@ provides = 1.2.3
stdout = '<ignore>'
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only

[moo_lt]
args = ["--libs", "provides-test-moo < 1.1.0"]
Expand All @@ -263,6 +279,7 @@ provides = 1.2.3
stdout = '<ignore>'
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only

[meow_ne]
args = ["--libs", "provides-test-meow != 1.3.0"]
Expand All @@ -273,12 +290,14 @@ provides = 1.2.3
stdout = '<ignore>'
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only

[meow_lt]
args = ["--libs", "provides-test-meow < 1.3.1"]
stdout = '<ignore>'
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only

[meow_lt2]
args = ["--libs", "provides-test-meow < 1.3.0"]
Expand All @@ -289,6 +308,7 @@ provides = 1.2.3
stdout = '<ignore>'
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only

[meow_ge2]
args = ["--libs", "provides-test-meow >= 1.3.1"]
Expand All @@ -299,6 +319,7 @@ provides = 1.2.3
stdout = '<ignore>'
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only

[meow_lt3]
args = ["--libs", "provides-test-meow < 1.2.9"]
Expand All @@ -313,3 +334,4 @@ provides = 1.2.3
args = ["--modversion", "provides-test-meow = 1.3.0"]
stderr = '<ignore>'
exitcode = 1
expected_fail = true # Windows-only
2 changes: 1 addition & 1 deletion tests/pkgconf/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down