Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cmake CTest给出“;不运行”;和“;错误的命令”;虽然命令直接起作用_Cmake_Ctest - Fatal编程技术网

Cmake CTest给出“;不运行”;和“;错误的命令”;虽然命令直接起作用

Cmake CTest给出“;不运行”;和“;错误的命令”;虽然命令直接起作用,cmake,ctest,Cmake,Ctest,我有一些代码,我想用一个小脚本来测试。它还没有完全完成,但至少以后会失败。以下是脚本: set -e set -u set -x echo "Hello!" "$1/contract" -i test_all.ini h5diff FILE1 FILE2 当我从命令行使用 /usr/bin/bash \ "/home/mu/Projekte/sLapH-contractions/integration-test-L4/run-integration-test" \ "/hom

我有一些代码,我想用一个小脚本来测试。它还没有完全完成,但至少以后会失败。以下是脚本:

set -e
set -u
set -x

echo "Hello!"
"$1/contract" -i test_all.ini
h5diff FILE1 FILE2
当我从命令行使用

/usr/bin/bash \
    "/home/mu/Projekte/sLapH-contractions/integration-test-L4/run-integration-test" \
    "/home/mu/Build/sLapH-contractions"
它按预期工作:

$ /usr/bin/bash "/home/mu/Projekte/sLapH-contractions/integration-test-L4/run-integration-test" "/home/mu/Build/sLapH-contractions"
+ echo 'Hello!'
Hello!
+ /home/mu/Build/sLapH-contractions/contract -i test_all.ini
CANNOT open input file: test_all.ini
+ h5diff FILE1 FILE2
h5diff: <FILE1>: unable to open file
当我使用
ctest
运行它时,它甚至不运行测试

$ ctest -VV
UpdateCTestConfiguration  from :/home/mu/Build/sLapH-contractions/DartConfiguration.tcl
UpdateCTestConfiguration  from :/home/mu/Build/sLapH-contractions/DartConfiguration.tcl
Test project /home/mu/Build/sLapH-contractions
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 1
    Start 1: sanity-1

1: Test command: /usr/bin/bash "-c" "echo Sanity 1"
1: Test timeout computed to be: 9.99988e+06
1: Sanity 1
1/2 Test #1: sanity-1 .........................   Passed    0.00 sec
test 2
    Start 2: integration-L4

2: Test command: /usr/bin/bash "/home/mu/Projekte/sLapH-contractions/integration-test-L4/run-integration-test" "/home/mu/Build/sLapH-contractions"
2: Test timeout computed to be: 9.99988e+06
2/2 Test #2: integration-L4 ...................***Not Run   0.00 sec

50% tests passed, 1 tests failed out of 2

Total Test time (real) =   0.01 sec

The following tests FAILED:
          2 - integration-L4 (BAD_COMMAND)
Errors while running CTest
我没有发现任何关于
BAD_命令的有用信息
错误


到底是什么原因阻止了该测试的运行?

您正在指定“${CMAKE\u CURRENT\u SOURCE\u DIR}/integration-test-L4/integration-test-L4”作为工作目录。确保该目录确实存在(如果重复错误,请删除最后一位)。

您正在指定“${CMAKE\u CURRENT\u SOURCE\u DIR}/integration-test-L4/integration-test-L4”作为工作目录。确保目录确实存在(如果重复错误,请删除最后一位)。

我在Windows上看到了类似的问题,使用了旧的CMake(v2.8.12)——一个在提示下运行的命令,但在CTest中的
BAD_命令时失败。潜在的问题是由于shell执行的可执行搜索导致的-有关更多信息,请参阅


因此,添加带有
add\u test(my\u test c:/node\u js/npm run test)
的测试不起作用,因为尽管
c:\node\u js\npm
存在,但它实际上执行
c:\node\u js\npm.cmd
。通过将
.cmd
附加到要执行的命令来修复此问题。

我在Windows上看到了类似的问题,它使用了较旧的CMake(v2.8.12)——一个在提示符下运行的命令,但使用CTest中的
BAD_命令失败。潜在的问题是由于shell执行的可执行搜索导致的-有关更多信息,请参阅


因此,添加带有
add\u test(my\u test c:/node\u js/npm run test)
的测试不起作用,因为尽管
c:\node\u js\npm
存在,但它实际上执行
c:\node\u js\npm.cmd
。通过将
.cmd
附加到要执行的命令来修复此问题。

如果您删除了健全性测试,并且只有一个测试,即出错的测试,是否会发生任何更改?不完全是,真正的测试会以同样的方式失败。目录
${CMAKE\u CURRENT\u SOURCE\u DIR}/integration-test-L4/integration-test-L4
是否存在?@Angew:No,它不存在。但是我在那里使用绝对路径,所以我不知道如何建立特定的路径…这是您指定的工作目录。你应该确保它存在。如果你删除了健全性测试,并且只有一个测试,即出错的测试,那么会有什么变化吗?实际上,真正的测试也会以同样的方式失败。目录
${CMAKE\u CURRENT\u SOURCE\u DIR}/integration-test-L4/integration-test-L4
存在吗?@Angew:不,它不存在。但是我在那里使用绝对路径,所以我不知道如何建立特定的路径…这是您指定的工作目录。你应该确保它存在。
$ ctest -VV
UpdateCTestConfiguration  from :/home/mu/Build/sLapH-contractions/DartConfiguration.tcl
UpdateCTestConfiguration  from :/home/mu/Build/sLapH-contractions/DartConfiguration.tcl
Test project /home/mu/Build/sLapH-contractions
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 1
    Start 1: sanity-1

1: Test command: /usr/bin/bash "-c" "echo Sanity 1"
1: Test timeout computed to be: 9.99988e+06
1: Sanity 1
1/2 Test #1: sanity-1 .........................   Passed    0.00 sec
test 2
    Start 2: integration-L4

2: Test command: /usr/bin/bash "/home/mu/Projekte/sLapH-contractions/integration-test-L4/run-integration-test" "/home/mu/Build/sLapH-contractions"
2: Test timeout computed to be: 9.99988e+06
2/2 Test #2: integration-L4 ...................***Not Run   0.00 sec

50% tests passed, 1 tests failed out of 2

Total Test time (real) =   0.01 sec

The following tests FAILED:
          2 - integration-L4 (BAD_COMMAND)
Errors while running CTest