|
| 1 | +#!@BASH@ |
| 2 | + |
| 3 | +# |
| 4 | +# Copyright © 2024 Inria. All rights reserved. |
| 5 | +# See COPYING in top-level directory. |
| 6 | +# |
| 7 | + |
| 8 | +set -e |
| 9 | + |
| 10 | +# the real _filedir() defined in /usr/share/bash-completion/bash_completion seems to fail here, |
| 11 | +# and we won't actually test it anyway, so just redefine it to empty |
| 12 | +_filedir() { |
| 13 | + return |
| 14 | +} |
| 15 | + |
| 16 | +# the real compopt doesn't work outside of actual completion |
| 17 | +compopt() { |
| 18 | + return |
| 19 | +} |
| 20 | + |
| 21 | +# load completions |
| 22 | +HWLOC_top_srcdir="@HWLOC_top_srcdir@" |
| 23 | +source $HWLOC_top_srcdir/contrib/completion/bash/hwloc |
| 24 | + |
| 25 | +COMP_WORDS=( "lstopo" "--o" ) |
| 26 | +COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 27 | +echo "Completing ${COMP_WORDS[*]}<tab>" |
| 28 | +_lstopo |
| 29 | +echo "Got ${COMPREPLY[*]}" |
| 30 | +test "${COMPREPLY[*]}" == "--os-index-prefix --output-format --of --osf --obj-snprintf-flags --only" |
| 31 | +echo "OK" |
| 32 | + |
| 33 | +COMP_WORDS=( "lstopo" "--palette" "" ) |
| 34 | +COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 35 | +echo "Completing ${COMP_WORDS[*]}<tab>" |
| 36 | +_lstopo |
| 37 | +echo "Got ${COMPREPLY[*]}" |
| 38 | +test "${COMPREPLY[*]}" == "grey greyscale default colors white none" |
| 39 | +echo "OK" |
| 40 | + |
| 41 | +COMP_WORDS=( "lstopo" "--filter" "i" ) |
| 42 | +COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 43 | +echo "Completing ${COMP_WORDS[*]}<tab>" |
| 44 | +_lstopo |
| 45 | +echo "Got ${COMPREPLY[*]}" |
| 46 | +test "${COMPREPLY[*]}" == "icache: io:" |
| 47 | +echo "OK" |
| 48 | + |
| 49 | +# "--filter type:kind" must be split into "--filter" "type" ":" "kind" outside of actual completion |
| 50 | +COMP_WORDS=( "lstopo" "--filter" "io" ":" "" ) |
| 51 | +COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 52 | +echo "Completing ${COMP_WORDS[*]}<tab>" |
| 53 | +_lstopo |
| 54 | +echo "Got ${COMPREPLY[*]}" |
| 55 | +test "${COMPREPLY[*]}" == "none all structure important" |
| 56 | +echo "OK" |
| 57 | + |
| 58 | +# "--foo=bar" must be split into "--foo" "=" "bar" outside of actual completion |
| 59 | +COMP_WORDS=( "lstopo" "--horiz" "=" "M" ) |
| 60 | +COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 61 | +echo "Completing ${COMP_WORDS[*]}<tab>" |
| 62 | +_lstopo |
| 63 | +echo "Got ${COMPREPLY[*]}" |
| 64 | +test "${COMPREPLY[*]}" == "Machine Misc MemCache" |
| 65 | +echo "OK" |
| 66 | + |
| 67 | +COMP_WORDS=( "hwloc-info" "--ancestor" ) |
| 68 | +COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 69 | +echo "Completing ${COMP_WORDS[*]}<tab>" |
| 70 | +_hwloc_info |
| 71 | +echo "Got ${COMPREPLY[*]}" |
| 72 | +test "${COMPREPLY[*]}" == "--ancestors --ancestor" |
| 73 | +echo "OK" |
| 74 | + |
| 75 | +COMP_WORDS=( "hwloc-info" "--ancestor" "P" ) |
| 76 | +COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 77 | +echo "Completing ${COMP_WORDS[*]}<tab>" |
| 78 | +_hwloc_info |
| 79 | +echo "Got ${COMPREPLY[*]}" |
| 80 | +test "${COMPREPLY[*]}" == "Package PCIDev PU" |
| 81 | +echo "OK" |
| 82 | + |
| 83 | +COMP_WORDS=( "hwloc-bind" "--membind" "--get" "--cof" "" ) |
| 84 | +COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 85 | +echo "Completing ${COMP_WORDS[*]}<tab>" |
| 86 | +_hwloc_bind |
| 87 | +echo "Got ${COMPREPLY[*]}" |
| 88 | +test "${COMPREPLY[*]}" == "hwloc list taskset" |
| 89 | +echo "OK" |
| 90 | + |
| 91 | +COMP_WORDS=( "hwloc-calc" "--cpukind" "" ) |
| 92 | +COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 93 | +echo "Completing ${COMP_WORDS[*]}<tab>" |
| 94 | +_hwloc_calc |
| 95 | +echo "Got ${COMPREPLY[*]}" |
| 96 | +test "${COMPREPLY[*]}" == "<name>=<value> <n> " |
| 97 | +echo "OK" |
| 98 | + |
| 99 | +COMP_WORDS=( "hwloc-annotate" "-" ) |
| 100 | +COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 101 | +echo "Completing ${COMP_WORDS[*]}<tab>" |
| 102 | +_hwloc_annotate |
| 103 | +echo "Got ${COMPREPLY[*]}" |
| 104 | +test "${COMPREPLY[*]}" = "--ci --ri --cu --cd --version -h --help" |
| 105 | +echo "OK" |
| 106 | + |
| 107 | +COMP_WORDS=( "hwloc-diff" "--re" ) |
| 108 | +COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 109 | +echo "Completing ${COMP_WORDS[*]}<tab>" |
| 110 | +_hwloc_diff |
| 111 | +echo "Got ${COMPREPLY[*]}" |
| 112 | +test "${COMPREPLY[*]}" = "--refname" |
| 113 | +echo "OK" |
| 114 | + |
| 115 | +COMP_WORDS=( "hwloc-patch" "--" ) |
| 116 | +COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 117 | +echo "Completing ${COMP_WORDS[*]}<tab>" |
| 118 | +_hwloc_patch |
| 119 | +echo "Got ${COMPREPLY[*]}" |
| 120 | +test "${COMPREPLY[*]}" = "--reverse --version --help" |
| 121 | +echo "OK" |
| 122 | + |
| 123 | +COMP_WORDS=( "hwloc-compress-dir" "--v" ) |
| 124 | +COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 125 | +echo "Completing ${COMP_WORDS[*]}<tab>" |
| 126 | +_hwloc_compress_dir |
| 127 | +echo "Got ${COMPREPLY[*]}" |
| 128 | +test "${COMPREPLY[*]}" = "--verbose --version" |
| 129 | +echo "OK" |
| 130 | + |
| 131 | +COMP_WORDS=( "hwloc-distrib" "--if" "" ) |
| 132 | +COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 133 | +echo "Completing ${COMP_WORDS[*]}<tab>" |
| 134 | +_hwloc_distrib |
| 135 | +echo "Got ${COMPREPLY[*]}" |
| 136 | +test "${COMPREPLY[*]}" = "xml synthetic fsroot cpuid" |
| 137 | +echo "OK" |
| 138 | + |
| 139 | +COMP_WORDS=( "hwloc-ps" "--children-of-pid" "" ) |
| 140 | +COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 141 | +echo "Completing ${COMP_WORDS[*]}<tab>" |
| 142 | +_hwloc_ps |
| 143 | +echo "Got ${COMPREPLY[*]}" |
| 144 | +test "${COMPREPLY[*]}" = "<pid> " |
| 145 | +echo "OK" |
| 146 | + |
| 147 | +COMP_WORDS=( "hwloc-gather-cpuid" "-c" "" ) |
| 148 | +COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 149 | +echo "Completing ${COMP_WORDS[*]}<tab>" |
| 150 | +_hwloc_gather_cpuid |
| 151 | +echo "Got ${COMPREPLY[*]}" |
| 152 | +test "${COMPREPLY[*]}" = "<index of cpu to operate on> " |
| 153 | +echo "OK" |
| 154 | + |
| 155 | +COMP_WORDS=( "hwloc-gather-topology" "-" ) |
| 156 | +COMP_CWORD=${#COMP_WORDS[*]}-1 |
| 157 | +echo "Completing ${COMP_WORDS[*]}<tab>" |
| 158 | +_hwloc_gather_topology |
| 159 | +echo "Got ${COMPREPLY[*]}" |
| 160 | +test "${COMPREPLY[*]}" = "--io --dmi --dt --no-cpuid --keep --version -h --help" |
| 161 | +echo "OK" |
0 commit comments