fix conflicts
This commit is contained in:
commit
b56a8dfaae
4
CHANGES
4
CHANGES
@ -1,4 +1,4 @@
|
|||||||
bash-completion (1.x)
|
bash-completion (1.1)
|
||||||
|
|
||||||
[ David Paleino ]
|
[ David Paleino ]
|
||||||
* Permit .gz files concatenation (Debian: #514377)
|
* Permit .gz files concatenation (Debian: #514377)
|
||||||
@ -182,7 +182,7 @@ bash-completion (1.x)
|
|||||||
* Fix leaking $muttcmd from mutt completion
|
* Fix leaking $muttcmd from mutt completion
|
||||||
* Fix completing multiple hosts (Debian: #535585)
|
* Fix completing multiple hosts (Debian: #535585)
|
||||||
|
|
||||||
-- David Paleino <d.paleino@gmail.com> Thu, 18 Jun 2009 13:12:36 +0200
|
-- David Paleino <d.paleino@gmail.com> Sat, 03 Oct 2009 15:41:49 +0200
|
||||||
|
|
||||||
bash-completion (1.0)
|
bash-completion (1.0)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# bash_completion - programmable completion functions for bash 3.x
|
# bash_completion - programmable completion functions for bash 3.x
|
||||||
# (backwards compatible with bash 2.05b)
|
# (backwards compatible with bash 2.05b)
|
||||||
#
|
#
|
||||||
# Copyright © 2006-2008, Ian Macdonald <ian@caliban.org>
|
# Copyright © 2006-2008, Ian Macdonald <ian@caliban.org>
|
||||||
# © 2009, Bash Completion Maintainers
|
# © 2009, Bash Completion Maintainers
|
||||||
@ -229,7 +229,7 @@ quote_readline()
|
|||||||
# This function shell-dequotes the argument
|
# This function shell-dequotes the argument
|
||||||
dequote()
|
dequote()
|
||||||
{
|
{
|
||||||
eval echo "$1"
|
eval echo "$1" 2> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get the word to complete.
|
# Get the word to complete.
|
||||||
@ -367,7 +367,7 @@ __get_cword4()
|
|||||||
|
|
||||||
cur=${cur:$word_start}
|
cur=${cur:$word_start}
|
||||||
printf "%s" "$cur"
|
printf "%s" "$cur"
|
||||||
} # _get_cword4()
|
} # __get_cword4()
|
||||||
|
|
||||||
|
|
||||||
# This function performs file and directory completion. It's better than
|
# This function performs file and directory completion. It's better than
|
||||||
@ -1451,7 +1451,7 @@ _command_offset()
|
|||||||
func=${func%% *}
|
func=${func%% *}
|
||||||
|
|
||||||
if [[ ${#COMP_WORDS[@]} -ge 2 ]]; then
|
if [[ ${#COMP_WORDS[@]} -ge 2 ]]; then
|
||||||
$func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}" "${COMP_WORDS[${#COMP_WORDS[@]}-2]}"
|
$func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}" "${COMP_WORDS[${#COMP_WORDS[@]}-2]}"
|
||||||
else
|
else
|
||||||
$func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}"
|
$func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}"
|
||||||
fi
|
fi
|
||||||
|
117
doc/testing.txt
117
doc/testing.txt
@ -82,18 +82,55 @@ The test suite requires a connected terminal (tty). When invoked via cron, no t
|
|||||||
can't read "multipass_name": no such variable
|
can't read "multipass_name": no such variable
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
|
|
||||||
To run the tests successfully via cron, connect a terminal by redirecting stdin from a tty, e.g. /dev/tty50:
|
To run the tests successfully via cron, connect a terminal by redirecting
|
||||||
|
stdin from a tty, e.g. /dev/tty40. (In Linux, you can press alt-Fx or
|
||||||
|
ctrl-alt-Fx to switch the console from /dev/tty1 to tty7. There are many more
|
||||||
|
/dev/tty* which are not accessed via function keys. To be safe, use a tty
|
||||||
|
greater than tty7)
|
||||||
|
|
||||||
----------------------
|
----------------------
|
||||||
./runUnit < /dev/tty50
|
./runUnit < /dev/tty40
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
If the process doesn't run as root, root will have to change the owner and
|
If the process doesn't run as root (recommended), root will have to change the
|
||||||
permissions of the tty.
|
owner and permissions of the tty:
|
||||||
|
-------------------------
|
||||||
|
sudo chmod o+r /dev/tty40
|
||||||
|
-------------------------
|
||||||
|
|
||||||
In Linux, you can press alt-Fx or ctrl-alt-Fx to switch the console from
|
To start the test at 01:00, set the crontab to this:
|
||||||
/dev/tty1 to tty7. There are many more /dev/tty* which are not accessed via
|
|
||||||
function keys. To be safe, use a tty greater than tty7?
|
|
||||||
|
|
||||||
|
* 1 * * * cd bash-completion/test && ./cron.sh < /dev/tty40
|
||||||
|
|
||||||
|
Here's an example batch file `cron.sh`, to be put in the bash-completion `test`
|
||||||
|
directory. This batch file only e-mails the output of each test-run if the
|
||||||
|
test-run fails.
|
||||||
|
|
||||||
|
[source,bash]
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e # Exit if simple command fails
|
||||||
|
set -u # Error if variable is undefined
|
||||||
|
|
||||||
|
LOG=/tmp/bash-completion.log~
|
||||||
|
|
||||||
|
# Retrieve latest sources
|
||||||
|
git pull
|
||||||
|
|
||||||
|
# Run tests on bash-3
|
||||||
|
|
||||||
|
./runUnit > $LOG || cat $LOG
|
||||||
|
./runCompletion > $LOG || cat $LOG
|
||||||
|
|
||||||
|
# Run tests on bash-4
|
||||||
|
|
||||||
|
./runUnit --outdir log/bash-4 --tool_exec /opt/bash-4.0/bin/bash > $LOG || cat $LOG
|
||||||
|
./runCompletion --outdir log/bash-4 --tool_exec /opt/bash-4.0/bin/bash > $LOG || cat $LOG
|
||||||
|
|
||||||
|
# Clean up log file
|
||||||
|
[ -f $LOG ] && rm $LOG
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
Specifying bash binary
|
Specifying bash binary
|
||||||
~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@ -124,12 +161,12 @@ Let's consider this real-life example where an ssh completion bug is fixed. Fir
|
|||||||
----------------------------------
|
----------------------------------
|
||||||
$ ./runCompletion
|
$ ./runCompletion
|
||||||
...
|
...
|
||||||
=== completion Summary ===
|
=== completion Summary ===
|
||||||
|
|
||||||
# of expected passes 283
|
# of expected passes 283
|
||||||
# of unexpected failures 8
|
# of unexpected failures 8
|
||||||
# of unresolved testcases 2
|
# of unresolved testcases 2
|
||||||
# of unsupported tests 47
|
# of unsupported tests 47
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
|
||||||
Take a look in `log/completion.log` to find out which specific command is failing.
|
Take a look in `log/completion.log` to find out which specific command is failing.
|
||||||
@ -151,10 +188,10 @@ In this case it appears `ssh.exp` is causing the problem. Isolate the `ssh` tes
|
|||||||
----------------------------------
|
----------------------------------
|
||||||
$ ./runCompletion ssh.exp --debug
|
$ ./runCompletion ssh.exp --debug
|
||||||
...
|
...
|
||||||
=== completion Summary ===
|
=== completion Summary ===
|
||||||
|
|
||||||
# of expected passes 1
|
# of expected passes 1
|
||||||
# of unresolved testcases 1
|
# of unresolved testcases 1
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
|
||||||
Now we can have a detailed look in `dbg.log` to find out what's going wrong. Open `dbg.log` and search for `UNRESOLVED` (or `FAIL` if that's what you're looking for):
|
Now we can have a detailed look in `dbg.log` to find out what's going wrong. Open `dbg.log` and search for `UNRESOLVED` (or `FAIL` if that's what you're looking for):
|
||||||
@ -203,10 +240,10 @@ Running the test reveals we still have an unresolved test:
|
|||||||
----------------------------------
|
----------------------------------
|
||||||
$ ./runCompletion ssh.exp --debug
|
$ ./runCompletion ssh.exp --debug
|
||||||
...
|
...
|
||||||
=== completion Summary ===
|
=== completion Summary ===
|
||||||
|
|
||||||
# of expected passes 1
|
# of expected passes 1
|
||||||
# of unresolved testcases 1
|
# of unresolved testcases 1
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
|
||||||
But if now look into the log file `dbg.log` we can see the completion only returns commands starting with 'ls' but fails to match our regular expression which also expects the hostname `ls_known_host':
|
But if now look into the log file `dbg.log` we can see the completion only returns commands starting with 'ls' but fails to match our regular expression which also expects the hostname `ls_known_host':
|
||||||
@ -229,9 +266,9 @@ until the test shows:
|
|||||||
----------------------------------
|
----------------------------------
|
||||||
$ ./runCompletion ssh.exp
|
$ ./runCompletion ssh.exp
|
||||||
...
|
...
|
||||||
=== completion Summary ===
|
=== completion Summary ===
|
||||||
|
|
||||||
# of expected passes 2
|
# of expected passes 2
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
|
||||||
Fixing a unit test
|
Fixing a unit test
|
||||||
@ -241,10 +278,10 @@ Now let's consider a unit test failure. First you're triggered by unsuccessful
|
|||||||
----------------------------------
|
----------------------------------
|
||||||
$ ./runUnit
|
$ ./runUnit
|
||||||
...
|
...
|
||||||
=== unit Summary ===
|
=== unit Summary ===
|
||||||
|
|
||||||
# of expected passes 1
|
# of expected passes 1
|
||||||
# of unexpected failures 1
|
# of unexpected failures 1
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
|
||||||
Take a look in `log/unit.log` to find out which specific command is failing.
|
Take a look in `log/unit.log` to find out which specific command is failing.
|
||||||
@ -266,10 +303,10 @@ In this case it appears `_known_hosts_real.exp` is causing the problem. Isolate
|
|||||||
----------------------------------
|
----------------------------------
|
||||||
$ ./runUnit _known_hosts_real.exp --debug
|
$ ./runUnit _known_hosts_real.exp --debug
|
||||||
...
|
...
|
||||||
=== completion Summary ===
|
=== completion Summary ===
|
||||||
|
|
||||||
# of expected passes 1
|
# of expected passes 1
|
||||||
# of unexpected failures 1
|
# of unexpected failures 1
|
||||||
----------------------------------
|
----------------------------------
|
||||||
|
|
||||||
Now, if we haven't already figured out the problem, we can have a detailed look in `dbg.log` to find out what's going wrong. Open `dbg.log` and search for `UNRESOLVED` (or `FAIL` if that's what you're looking for):
|
Now, if we haven't already figured out the problem, we can have a detailed look in `dbg.log` to find out what's going wrong. Open `dbg.log` and search for `UNRESOLVED` (or `FAIL` if that's what you're looking for):
|
||||||
@ -364,13 +401,13 @@ Setting up bash once within `completion_start()` has the speed advantage that ba
|
|||||||
|
|
||||||
.What happens when install tests are run?
|
.What happens when install tests are run?
|
||||||
----
|
----
|
||||||
| runtest --tool install
|
| runtest --tool install
|
||||||
V
|
V
|
||||||
+----+----+
|
+----+----+
|
||||||
| DejaGnu |
|
| DejaGnu |
|
||||||
+----+----+
|
+----+----+
|
||||||
|
|
|
|
||||||
V
|
V
|
||||||
+------------+---------------+
|
+------------+---------------+
|
||||||
| (file: config/default.exp) |
|
| (file: config/default.exp) |
|
||||||
+------------+---------------+
|
+------------+---------------+
|
||||||
@ -385,13 +422,13 @@ Setting up bash once within `completion_start()` has the speed advantage that ba
|
|||||||
|
|
||||||
.What happens when unit tests are run?
|
.What happens when unit tests are run?
|
||||||
----
|
----
|
||||||
| runtest --tool unit
|
| runtest --tool unit
|
||||||
V
|
V
|
||||||
+----+----+
|
+----+----+
|
||||||
| DejaGnu |
|
| DejaGnu |
|
||||||
+----+----+
|
+----+----+
|
||||||
|
|
|
|
||||||
V
|
V
|
||||||
+----------+-----------+
|
+----------+-----------+
|
||||||
| - |
|
| - |
|
||||||
| (file: lib/unit.exp) |
|
| (file: lib/unit.exp) |
|
||||||
|
0
test/fixtures/evince/foo/.gitignore
vendored
Normal file
0
test/fixtures/evince/foo/.gitignore
vendored
Normal file
0
test/fixtures/kdvi/foo/.gitignore
vendored
Normal file
0
test/fixtures/kdvi/foo/.gitignore
vendored
Normal file
0
test/fixtures/kpdf/foo/.gitignore
vendored
Normal file
0
test/fixtures/kpdf/foo/.gitignore
vendored
Normal file
@ -95,7 +95,24 @@ lappend expected doo: gee: hus: ike: jar:
|
|||||||
# Append local filenames
|
# Append local filenames
|
||||||
lappend expected config known_hosts "spaced\\\\ \\\\ conf"
|
lappend expected config known_hosts "spaced\\\\ \\\\ conf"
|
||||||
set dir fixtures/scp
|
set dir fixtures/scp
|
||||||
assert_complete_dir $expected "scp -F 'spaced conf' " $dir
|
#assert_complete_dir $expected "scp -F 'spaced conf' " $dir
|
||||||
|
set prompt "/$dir/@"
|
||||||
|
assert_bash_exec "cd $dir" "" $prompt
|
||||||
|
set cmd "scp -F 'spaced conf' "
|
||||||
|
send "$cmd\t"
|
||||||
|
expect -ex "$cmd\r\n"
|
||||||
|
if {[match_items $expected $test]} {
|
||||||
|
expect {
|
||||||
|
-re $prompt { pass "$test" }
|
||||||
|
-re eof { unresolved "eof" }
|
||||||
|
}; # expect
|
||||||
|
} else {
|
||||||
|
# Expected failure (known bug) because of bash-4 bug in quoted words:
|
||||||
|
# http://www.mail-archive.com/bug-bash@gnu.org/msg06095.html
|
||||||
|
if {$bash_versinfo_0 >= 4} {xfail "$test"} {fail "$test"}
|
||||||
|
}; # if
|
||||||
|
sync_after_int $prompt
|
||||||
|
assert_bash_exec "cd \$TESTDIR"
|
||||||
|
|
||||||
|
|
||||||
sync_after_int
|
sync_after_int
|
||||||
|
@ -48,8 +48,8 @@ set expected [get_hosts]
|
|||||||
# Hosts `gee', `hus' and `jar' are defined in "./fixtures/scp/spaced conf"
|
# Hosts `gee', `hus' and `jar' are defined in "./fixtures/scp/spaced conf"
|
||||||
# Hosts `doo' and `ike' are defined in ./fixtures/scp/known_hosts
|
# Hosts `doo' and `ike' are defined in ./fixtures/scp/known_hosts
|
||||||
lappend expected doo gee hus ike jar
|
lappend expected doo gee hus ike jar
|
||||||
set dir fixtures/scp
|
set dir fixtures/sftp
|
||||||
assert_complete_dir $expected "sftp -F 'spaced conf' " $dir
|
assert_complete_dir $expected "sftp -F spaced\\ \\ conf " $dir
|
||||||
|
|
||||||
|
|
||||||
sync_after_int
|
sync_after_int
|
||||||
|
@ -383,7 +383,8 @@ proc match_items {items test {size 20}} {
|
|||||||
}; # for
|
}; # for
|
||||||
if {[llength $items] == 1} {
|
if {[llength $items] == 1} {
|
||||||
expect {
|
expect {
|
||||||
-re "^$expected$" { set result true }
|
# NOTE: The optional space ( ?) depends on whether -o nospace is active
|
||||||
|
-re "^$expected ?$" { set result true }
|
||||||
"\r\n" { set result false; break }
|
"\r\n" { set result false; break }
|
||||||
default { set result false; break }
|
default { set result false; break }
|
||||||
timeout { set result false; break }
|
timeout { set result false; break }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user