github.com/0xKiwi/rules_go@v0.24.3/tests/legacy/extldflags_rpath/extldflags_rpath_test.sh (about)

     1  #!/bin/sh
     2  
     3  if [ $# -ne 1 ]; then
     4    echo "usage: $0 binaryfile" >&1
     5    exit 1
     6  fi
     7  
     8  binaryfile=$1
     9  os=$(uname)
    10  case $os in
    11    Linux)
    12      output=$(readelf --dynamic "$binaryfile")
    13      ;;
    14    Darwin)
    15      output=$(otool -l "$binaryfile")
    16      ;;
    17    *)
    18      echo "unsupported platform: $os" >&1
    19      exit 1
    20  esac
    21  
    22  for path in /foo /bar ; do
    23    if ! echo "$output" | grep --quiet "$path" ; then
    24      echo "$binaryfile: could not find $path in rpaths" >&1
    25      exit 1
    26    fi
    27  done