expect-lite을 사용하여 CLI 프로그램을 자동화하는 방법을 배우려고합니다. 그러나 몇 시간 동안 문서를 읽은 후에도, 나는 아주 간단한 스크립트를 실행하지 않고 간단한 C++ 프로그램을 테스트하지 못하고있다. Windows에서 expect-lite를 실행하기 위해 cygwin을 사용하고 있습니다. 내 프로그램은 대가로 사용자 입력 및 인쇄 뭔가를받습니다Expect-lite : 사소한 C++ 프로그램에서 매우 간단한 스크립트 실패
#include <iostream>
#include <string>
using namespace std;
int main(){
string command;
cout << "Input command:\n";
cin >> command;
if (command=="continue")
cout << "We shall continue";
else
cout << "The end";
return 0;
}
그리고 내 기대 라이트 스크립트는 다음과 같습니다
> ./myprogram
< Input command:
>> continue
< We shall continue
하지만 얻을 출력은 다음과 같다 :
$ ./expect-lite -c testing.elt
Warning: Remote Host=none, using Localhost
spawn bash
[email protected] ~/expect-lite.proj
$
[email protected] ~/expect-lite.proj
$
[email protected] ~/expect-lite.proj
$
[email protected] ~/expect-lite.proj
$ PS1="[\[email protected]\h:\w]\$ "
[[email protected]:~/expect-lite.proj]$
[[email protected]:~/expect-lite.proj]$ ./myprogram
Input command:
Waiting: ....+....
FAILED COMMAND: ./myprogram
Expect Failed: Input command:
exit
The end[[email protected]:~/expect-lite.proj]$
##Overall Result: FAILED
[email protected] ~/expect-lite.proj
매우 간단한 프로그램을 시작으로이 간단한 스크립트 만 시도했지만 작동하지는 않습니다. 그 이유에 대한 아이디어가 있습니까?