Add a test for relocations that are valid paths but would be invalid URIs if mis-interpreted
authorJ. Ali Harlow <ali@juiblex.co.uk>
Mon Mar 05 09:43:14 2018 +0000 (2018-03-05)
changeset 49306f70d662e39
parent 492 644b648173b0
child 494 889dc38157ac
Add a test for relocations that are valid paths but would be invalid URIs if mis-interpreted
test/Makefile.am
test/non-pchar.sh
     1.1 --- a/test/Makefile.am	Thu Jul 14 11:43:16 2016 +0100
     1.2 +++ b/test/Makefile.am	Mon Mar 05 09:43:14 2018 +0000
     1.3 @@ -12,7 +12,7 @@
     1.4    check_SCRIPTS += curl
     1.5  endif
     1.6  endif
     1.7 -check_SCRIPTS += order non-ascii relative-root
     1.8 +check_SCRIPTS += order non-ascii relative-root non-pchar
     1.9  
    1.10  if !MSWIN_API
    1.11    check_PROGRAMS = tftpd
    1.12 @@ -46,6 +46,9 @@
    1.13  relative-root:	relative-root.sh base/repodata/primary.xml.gz
    1.14  	cp $(srcdir)/relative-root.sh relative-root
    1.15  
    1.16 +non-pchar:	non-pchar.sh base/repodata/primary.xml.gz
    1.17 +	cp $(srcdir)/non-pchar.sh non-pchar
    1.18 +
    1.19  lua:	lua.sh base/repodata/primary.xml.gz
    1.20  	cp $(srcdir)/lua.sh lua
    1.21  
    1.22 @@ -108,6 +111,7 @@
    1.23  	details.sh		\
    1.24  	details.ref		\
    1.25  	named-root.sh		\
    1.26 +	non-pchar.sh		\
    1.27  	relocate.sh
    1.28  
    1.29  MOSTLYCLEANFILES =		\
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/test/non-pchar.sh	Mon Mar 05 09:43:14 2018 +0000
     2.3 @@ -0,0 +1,31 @@
     2.4 +#!/bin/sh
     2.5 +set -x
     2.6 +if [ $# -gt 0 ]; then
     2.7 +    razor="$1"
     2.8 +else
     2.9 +    razor=../src/razor
    2.10 +fi
    2.11 +check_file()
    2.12 +{
    2.13 +    $razor list-files | grep -F -x "$1" > /dev/null
    2.14 +    if [ $? -ne 0 ]; then
    2.15 +	echo $1: Not in database >&2
    2.16 +	exit 1
    2.17 +    fi
    2.18 +    if [ ! -e "$tmpdir$1" ]; then 
    2.19 +	echo $1: Not in filesystem >&2
    2.20 +	exit 1
    2.21 +    fi
    2.22 +}
    2.23 +tmpdir=`mktemp -dt` || exit 1
    2.24 +export RAZOR_ROOT="file:$tmpdir"
    2.25 +$razor init || exit 1
    2.26 +export YUM_URL="file:`pwd`/base"
    2.27 +$razor import-yum || exit 1
    2.28 +$razor install zap || exit 1
    2.29 +$razor install --relocate "/usr=/my files" --relocate "/etc=/my files/καὶ τὰ ἕτερα" zsh || exit 1
    2.30 +check_file /etc/zsh.conf
    2.31 +check_file /usr/bin/zap
    2.32 +check_file "/my files/bin/zip"
    2.33 +check_file "/my files/bin/zsh"
    2.34 +rm -rf "$tmpdir"