다른 코드 (pseudo-bash)에서 테스트를 실행해야하는 코드 (1)가 있습니다. 이 코드 (1)는 '사용자 시뮬레이션'에 '기대'를 사용하여 작성합니다.시스템 명령 rm이 예상 프로그램에서 작동하지 않습니다.
문제는이 코드 (1)가 titiExpected.txt를 찾을 수 없을 때 시스템 (이 경우 "rm totoExpect.txt titiExpect.txt"시스템)을 실행할 때 발생하지만 거기에 있습니다!
두 파일간에 차이가 없으며 사용 권한도 동일하기 때문에 그 이유는 생각할 수 없습니다.
# test 5
proc t5 {} {
send "ls > totoExpect.txt\r"
send "cat < totoExpect.txt | wc -l > titiExpect.txt\r"
send "cat titiExpect.txt\r"
expect -re "(0|1|2|3|4|5|6|7|8|9)+.*>" { ok 5; } default { abort 5 }
system "rm totoExpect.txt titiExpect.txt"
}
그리고 오류 메시지 :
ls > totoExpect.txt
out: totoExpect.txt
seq[0]: 'ls'
-----3
ensishell>c
***** TEST 5 ok
rm: não foi possível remover "titiExpect.txt": Arquivo ou diretório não encontrado
child process exited abnormally
while executing
"system "rm totoExpect.txt titiExpect.txt""
(procedure "t5" line 6)
invoked from within
"t5"
("eval" body line 1)
invoked from within
"eval "t$t;" "
("foreach" body line 1)
invoked from within
"foreach t {0 1 2 3 4 5 6 7} { eval "t$t;" } "
invoked from within
"expect_user {
-timeout 30 "auto\n" {
puts "AUTO:\n";
foreach t {0 1 2 3 4 5 6 7} { eval "t$t;" }
}
-timeout 30 -re "(\[\]+)\..."
(file "./testshell.expect" line 99)
make: ** [test] Erro 1
경우 "RM : NAO FOI possível 제거"titiExpect.txt 여기
코드 (1) 문제가 제기 곳의 일부입니다 ":은"rm : "titiExpect.txt"파일이나 디렉토리를 찾을 수 없습니다 (죄송합니다 ...).및 this 인 LS 그냥 오류 메시지가 후 (그래서 titiExpect.txt이 야해) -l :
-rwxrwxr-x 1 fernando fernando 273 Out 23 17:53 #Makefile#
-rwxrwxr-x 1 fernando fernando 6238 Nov 5 21:18 #ensishell.c#
-rwxrwxr-x 1 fernando fernando 1271 Out 24 20:30 #readcmd.h#
-rwxrwxr-x 1 fernando fernando 3250 Nov 5 21:07 #testshell.expect#
-rwxrwxrwx 1 fernando fernando 303 Out 24 20:21 Makefile
drwxrwxr-x 2 fernando fernando 4096 Nov 4 19:06 SEPC shell
-rw-rw-r-- 1 fernando fernando 193453 Out 18 18:25 Sujet_shell.pdf
-rwxrwxr-x 1 fernando fernando 25451 Nov 5 21:17 ensishell
-rwxrwxrwx 1 fernando fernando 6238 Nov 5 20:32 ensishell.c
-rw-rw-r-- 1 fernando fernando 10664 Nov 5 21:17 ensishell.o
-rwxrwxr-x 1 fernando fernando 7251 Nov 4 00:33 foo
-rw-rw-r-- 1 fernando fernando 173 Nov 4 00:33 foo.c
-rw-rw-r-- 1 fernando fernando 16 Nov 4 01:15 in.txt~
-rwxrwxrwx 1 fernando fernando 6603 Out 23 00:37 readcmd.c
-rwxrwxrwx 1 fernando fernando 1271 Out 23 01:24 readcmd.h
-rwxrwxrwx 1 fernando fernando 1271 Out 23 00:37 readcmd.h~
-rw-rw-r-- 1 fernando fernando 11216 Nov 5 21:17 readcmd.o
-rwxrwxrwx 1 fernando fernando 3250 Nov 5 20:41 testshell.expect
-rwx------ 1 fernando fernando 1263 Nov 5 12:43 toto.txt
최악의 문제는이 코드 수정이 안된다, 그러나 그 날이 보인다하면 프로그램 오류입니다 이것은 실패합니다. (사실, 문제를 해결하는 라인을 주석 ..)
어떤 아이디어?
파일 권한'totoExpect.txt' 및'titiExpect.txt' 파일들? – askmish
두 사용자 모두 rwx – FernandoP