]> git.proxmox.com Git - ceph.git/blame - ceph/src/ceph-volume/ceph_volume/tests/functional/scripts/test_unicode.sh
import 15.2.0 Octopus source
[ceph.git] / ceph / src / ceph-volume / ceph_volume / tests / functional / scripts / test_unicode.sh
CommitLineData
494da23a
TL
1#!/bin/bash
2
3# Not entirely sure why these executables don't seem to be available in the
4# $PATH when running from tox. Calling out to `which` seems to fix it, at the
5# expense of making the script a bit obtuse
6
7mktemp=$(which mktemp)
8cat=$(which cat)
9grep=$(which grep)
9f95a23c 10PYTHON_EXECUTABLE=`which python3`
494da23a
TL
11STDERR_FILE=$($mktemp)
12INVALID="→"
13
14echo "stderr file created: $STDERR_FILE"
15
16INVALID="$INVALID" $PYTHON_EXECUTABLE $1 2> ${STDERR_FILE}
17
18retVal=$?
19
20if [ $retVal -ne 0 ]; then
21 echo "Failed test: Unexpected failure from running Python script"
22 echo "Below is output of stderr captured:"
23 $cat "${STDERR_FILE}"
24 exit $retVal
25fi
26
27$grep --quiet "$INVALID" ${STDERR_FILE}
28
29retVal=$?
30if [ $retVal -ne 0 ]; then
31 echo "Failed test: expected to find \"${INVALID}\" character in tmpfile: \"${STDERR_FILE}\""
32 echo "Below is output of stderr captured:"
33 $cat "${STDERR_FILE}"
34fi
35exit $retVal