Skip to content

Commit

Permalink
Merge pull request #1105 from Kijewski/shell-print-not-found
Browse files Browse the repository at this point in the history
shell: print command if not found
  • Loading branch information
OlegHahm committed Jun 22, 2014
2 parents eedc168 + ebe7026 commit 6f17f0c
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 90 deletions.
3 changes: 2 additions & 1 deletion sys/shell/shell.c
Expand Up @@ -202,7 +202,8 @@ static void handle_input_line(shell_t *shell, char *line)
print_help(shell->command_list);
}
else {
puts("shell: command not found.");
puts("shell: command not found:");
puts(argv[0]);
}
}
}
Expand Down
9 changes: 7 additions & 2 deletions tests/test_shell/tests/01-basic
@@ -1,10 +1,15 @@
#!/usr/bin/expect

spawn make term

set timeout 5
expect {
"test_shell" {}
timeout { exit 1 }
}

spawn make term
set timeout 1

sleep 1
send "\n"
send "\n"
expect {
Expand Down
83 changes: 0 additions & 83 deletions tests/test_shell/tests/02-inputlength-regression

This file was deleted.

18 changes: 14 additions & 4 deletions tests/test_shell/tests/02-unknown-command
@@ -1,10 +1,15 @@
#!/usr/bin/expect

set timeout 2

spawn make term

sleep 1
set timeout 5
expect {
"test_shell" {}
timeout { exit 1 }
}

set timeout 1

send "\n"
send "\n"
expect {
Expand All @@ -14,7 +19,12 @@ expect {

send "some_definately_unknown_command\n"
expect {
"shell: command not found." {}
"shell: command not found:" {
expect {
"some_definately_unknown_command" {}
timeout { exit 1 }
}
}
timeout { exit 1 }
}

Expand Down
53 changes: 53 additions & 0 deletions tests/test_shell/tests/03-inputlength-regression
@@ -0,0 +1,53 @@
#!/usr/bin/expect

spawn make term

set timeout 5
expect {
"test_shell" {}
timeout { exit 1 }
}

set timeout 1

send "\n"
expect {
">" {}
timeout { exit 1 }
}

send "start_test\n"
expect {
"\[TEST_START\]" {}
timeout { exit 1 }
}
expect {
">" {}
timeout { exit 1 }
}

for { set i 0 } { $i < 10 } { incr i 1 } {
send "123456789012345678901234567890123456789012345678901234567890\n"
expect {
"shell: command not found:" {
expect {
"123456789012345678901234567890123456789012345678901234567890" {}
timeout { exit 1 }
}
}
timeout { exit 1 }
}
}

send "end_test\n"
expect {
"\[TEST_END\]" {}
timeout { exit 1 }
}
expect {
">" {}
timeout { exit 1 }
}

sleep 1
puts "\nTest successful!\n"

0 comments on commit 6f17f0c

Please sign in to comment.