test/mult-install.sh
author J. Ali Harlow <ali@juiblex.co.uk>
Wed Apr 22 13:09:42 2015 +0100 (2015-04-22)
changeset 465 271bb9e6e10f
parent 389 4aac72ec4537
child 475 008c75a5e08d
permissions -rwxr-xr-x
Add -lole32 to link libraries.

This fixes a problem when compiling with mingw-headers version 3.3
where the use of SHGetFolderPath() expands to a call to CoTaskMemFree()
which is defined in libole32.dll:

/usr/x86_64-w64-mingw32/sys-root/mingw/include/shobjidl.h:29954: undefined reference to `__imp_CoTaskMemFree'
     1 #!/bin/sh
     2 if [ $# -gt 0 ]; then
     3     razor="$1"
     4 else
     5     razor=../src/razor
     6 fi
     7 fs_check_file()
     8 {
     9     if [ ! -e "$RAZOR_ROOT$1" ]; then 
    10 	echo $1: Not in filesystem >&2
    11 	ls -R "$RAZOR_ROOT" >&2
    12 	exit 1
    13     fi
    14 }
    15 fs_check_file_contents()
    16 {
    17     fs_check_file "$1"
    18     if [ `cat "$RAZOR_ROOT$1"` != "$2" ]; then
    19 	echo $1: Unexpected contents >&2
    20 	cat "$RAZOR_ROOT$1" >&2
    21 	exit 1
    22     fi
    23 }
    24 fs_check_no_file()
    25 {
    26     if [ -e "$RAZOR_ROOT$1" ]; then 
    27 	echo $1: Still in filesystem >&2
    28 	exit 1
    29     fi
    30 }
    31 check_file()
    32 {
    33     $razor list-files | grep -x "$1" > /dev/null
    34     if [ $? -ne 0 ]; then
    35 	echo $1: Not in database >&2
    36 	$razor list-files >&2
    37 	exit 1
    38     fi
    39     $razor list-files "$1" | grep -x "$1" > /dev/null
    40     if [ $? -ne 0 ]; then
    41 	echo $1: Not seen by patterned list >&2
    42 	$razor list-files "$1" >&2
    43 	exit 1
    44     fi
    45     pkgs=`$razor list-file-packages "$1"`
    46     if [ -z "$pkgs" ]; then
    47 	echo $1: Not owned by any package >&2
    48 	$razor list-file-packages "$1"
    49 	exit 1
    50     fi
    51     for nevra in "$pkgs"; do
    52 	name=`echo $nevra | sed 's/\-.*$//'`
    53 	$razor list-package-files "$name" | grep -x "$1" > /dev/null
    54 	if [ $? -ne 0 ]; then
    55 	    echo $1: Not in database for package $name >&2
    56 	    $razor list-package-files "$name"
    57 	    exit 1
    58 	fi
    59     done
    60     fs_check_file $1
    61 }
    62 check_no_file()
    63 {
    64     $razor list-files | grep -x "$1" > /dev/null
    65     if [ $? -eq 0 ]; then
    66 	echo $1: Still in database >&2
    67 	exit 1
    68     fi
    69     fs_check_no_file $1
    70 }
    71 check_install_count()
    72 {
    73     count=`$razor list "$1" | wc -l`
    74     if [ "$count" != "$2" ]; then
    75 	echo $1: Install count $count, should be $2 >&2
    76 	exit 1
    77     fi
    78 }
    79 export RAZOR_ROOT=`mktemp -dt` || exit 1
    80 $razor init || exit 1
    81 export YUM_URL="file://localhost/`pwd`"
    82 $razor import-yum || exit 1
    83 $razor install --relocate /usr=/opt zip || exit 1
    84 fs_check_file_contents /opt/bin/zip zip-1-1
    85 fs_check_file /opt/var/lib/zip/data.zap
    86 $razor install --relocate /usr=/opt zip || exit 1
    87 check_install_count zip 2
    88 $razor install --relocate /usr=/opt zip || exit 1
    89 check_install_count zip 3
    90 rm -rf "$RAZOR_ROOT"