fix conflicts

This commit is contained in:
Guillaume Rousse 2009-10-04 19:46:01 +02:00
commit b56a8dfaae
9 changed files with 105 additions and 50 deletions

View File

@ -1,4 +1,4 @@
bash-completion (1.x)
bash-completion (1.1)
[ David Paleino ]
* Permit .gz files concatenation (Debian: #514377)
@ -182,7 +182,7 @@ bash-completion (1.x)
* Fix leaking $muttcmd from mutt completion
* 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)

View File

@ -1,6 +1,6 @@
#
# 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>
# © 2009, Bash Completion Maintainers
@ -229,7 +229,7 @@ quote_readline()
# This function shell-dequotes the argument
dequote()
{
eval echo "$1"
eval echo "$1" 2> /dev/null
}
# Get the word to complete.
@ -367,7 +367,7 @@ __get_cword4()
cur=${cur:$word_start}
printf "%s" "$cur"
} # _get_cword4()
} # __get_cword4()
# This function performs file and directory completion. It's better than
@ -1451,7 +1451,7 @@ _command_offset()
func=${func%% *}
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
$func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}"
fi

View File

@ -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
---------------------------------------------
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
permissions of the tty.
If the process doesn't run as root (recommended), root will have to change the
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
/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?
To start the test at 01:00, set the crontab to this:
* 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
~~~~~~~~~~~~~~~~~~~~~~
@ -124,12 +161,12 @@ Let's consider this real-life example where an ssh completion bug is fixed. Fir
----------------------------------
$ ./runCompletion
...
=== completion Summary ===
=== completion Summary ===
# of expected passes 283
# of unexpected failures 8
# of unresolved testcases 2
# of unsupported tests 47
# of expected passes 283
# of unexpected failures 8
# of unresolved testcases 2
# of unsupported tests 47
----------------------------------
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
...
=== completion Summary ===
=== completion Summary ===
# of expected passes 1
# of unresolved testcases 1
# of expected passes 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):
@ -203,10 +240,10 @@ Running the test reveals we still have an unresolved test:
----------------------------------
$ ./runCompletion ssh.exp --debug
...
=== completion Summary ===
=== completion Summary ===
# of expected passes 1
# of unresolved testcases 1
# of expected passes 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':
@ -229,9 +266,9 @@ until the test shows:
----------------------------------
$ ./runCompletion ssh.exp
...
=== completion Summary ===
=== completion Summary ===
# of expected passes 2
# of expected passes 2
----------------------------------
Fixing a unit test
@ -241,10 +278,10 @@ Now let's consider a unit test failure. First you're triggered by unsuccessful
----------------------------------
$ ./runUnit
...
=== unit Summary ===
=== unit Summary ===
# of expected passes 1
# of unexpected failures 1
# of expected passes 1
# of unexpected failures 1
----------------------------------
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
...
=== completion Summary ===
=== completion Summary ===
# of expected passes 1
# of unexpected failures 1
# of expected passes 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):
@ -364,13 +401,13 @@ Setting up bash once within `completion_start()` has the speed advantage that ba
.What happens when install tests are run?
----
| runtest --tool install
V
+----+----+
| DejaGnu |
+----+----+
|
V
| runtest --tool install
V
+----+----+
| DejaGnu |
+----+----+
|
V
+------------+---------------+
| (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?
----
| runtest --tool unit
V
+----+----+
| DejaGnu |
+----+----+
|
V
| runtest --tool unit
V
+----+----+
| DejaGnu |
+----+----+
|
V
+----------+-----------+
| - |
| (file: lib/unit.exp) |

0
test/fixtures/evince/foo/.gitignore vendored Normal file
View File

0
test/fixtures/kdvi/foo/.gitignore vendored Normal file
View File

0
test/fixtures/kpdf/foo/.gitignore vendored Normal file
View File

View File

@ -95,7 +95,24 @@ lappend expected doo: gee: hus: ike: jar:
# Append local filenames
lappend expected config known_hosts "spaced\\\\ \\\\ conf"
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

View File

@ -48,8 +48,8 @@ set expected [get_hosts]
# Hosts `gee', `hus' and `jar' are defined in "./fixtures/scp/spaced conf"
# Hosts `doo' and `ike' are defined in ./fixtures/scp/known_hosts
lappend expected doo gee hus ike jar
set dir fixtures/scp
assert_complete_dir $expected "sftp -F 'spaced conf' " $dir
set dir fixtures/sftp
assert_complete_dir $expected "sftp -F spaced\\ \\ conf " $dir
sync_after_int

View File

@ -383,7 +383,8 @@ proc match_items {items test {size 20}} {
}; # for
if {[llength $items] == 1} {
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 }
default { set result false; break }
timeout { set result false; break }