components/libpki/files/setup_test.sh
author Rich Burridge <rich.burridge@oracle.com>
Wed, 20 Jul 2016 10:13:37 -0700
changeset 6439 b66f3093f546
parent 6257 cdf29f584705
permissions -rwxr-xr-x
24289304 nosetests manpages delivered in /usr/share/man, not /usr/share/man/man1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5897
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
     1
#!/bin/sh
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
     2
#
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
     3
# CDDL HEADER START
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
     4
#
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
     8
#
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    11
# See the License for the specific language governing permissions
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    12
# and limitations under the License.
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    13
#
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    19
#
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    20
# CDDL HEADER END
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    21
#
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    22
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    23
#
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    24
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    25
BUILD_DIR=$1
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    26
COMPONENT_SRC=$2
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    27
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    28
export PATH=/bin:$PATH
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    29
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    30
# Replace the path to that under component build dir
6257
cdf29f584705 23528052 libpki's configure and Makefile need refactoring
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents: 5897
diff changeset
    31
gsed -i 's|\"etc\"|'\""$BUILD_DIR"'/etc\"|g' $COMPONENT_SRC/src/tests/test6.c
cdf29f584705 23528052 libpki's configure and Makefile need refactoring
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents: 5897
diff changeset
    32
gsed -i 's|\"etc\"|'\""$BUILD_DIR"'/etc\"|g' $COMPONENT_SRC/src/tests/test8.c
5897
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    33
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    34
# Make dirs under component build dir and copy necessary files under them
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    35
rm -rf $BUILD_DIR/etc/hsm.d
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    36
mkdir $BUILD_DIR/etc/hsm.d
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    37
cp $COMPONENT_SRC/etc/hsm.d/etoken-engine.xml $BUILD_DIR/etc/hsm.d
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    38
rm $BUILD_DIR/etc/objectIdentifiers.xml
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    39
cp $COMPONENT_SRC/etc/objectIdentifiers.xml $BUILD_DIR/etc
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    40
rm -rf $BUILD_DIR/etc/token.d
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    41
mkdir $BUILD_DIR/etc/token.d
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    42
cp $COMPONENT_SRC/etc/token.d/test.xml $BUILD_DIR/etc/token.d
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    43
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    44
# Replace the path to that under component build dir
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    45
sed -e 's|/$HOME|'"$BUILD_DIR"'/etc|g' $COMPONENT_SRC/etc/token.d/default.xml > $BUILD_DIR/etc/token.d/default.xml
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    46
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    47
# Copy .libpki dir under component build dir
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    48
rm -rf $BUILD_DIR/etc/.libpki
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    49
cp -R $COMPONENT_SRC/etc/.libpki $BUILD_DIR/etc
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    50
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    51
# Make results dir under component build dir
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    52
rm -rf $BUILD_DIR/results
495a9e2444e4 PSARC/2016/220 libPKI
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents:
diff changeset
    53
mkdir $BUILD_DIR/results
6257
cdf29f584705 23528052 libpki's configure and Makefile need refactoring
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents: 5897
diff changeset
    54
cdf29f584705 23528052 libpki's configure and Makefile need refactoring
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents: 5897
diff changeset
    55
# Build test scripts
cdf29f584705 23528052 libpki's configure and Makefile need refactoring
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents: 5897
diff changeset
    56
gmake -C $BUILD_DIR/src/tests check-am
cdf29f584705 23528052 libpki's configure and Makefile need refactoring
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents: 5897
diff changeset
    57
cdf29f584705 23528052 libpki's configure and Makefile need refactoring
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents: 5897
diff changeset
    58
# Test scripts need escapes because they are executed indirectly
cdf29f584705 23528052 libpki's configure and Makefile need refactoring
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents: 5897
diff changeset
    59
for i in {1..9}
cdf29f584705 23528052 libpki's configure and Makefile need refactoring
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents: 5897
diff changeset
    60
do
cdf29f584705 23528052 libpki's configure and Makefile need refactoring
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents: 5897
diff changeset
    61
	gsed -i 's|$libtool_install_magic|$$libtool_install_magic|g' $BUILD_DIR/src/tests/test$i
cdf29f584705 23528052 libpki's configure and Makefile need refactoring
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents: 5897
diff changeset
    62
	gsed -i 's|$libtool_execute_magic|$$libtool_execute_magic|g' $BUILD_DIR/src/tests/test$i
cdf29f584705 23528052 libpki's configure and Makefile need refactoring
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents: 5897
diff changeset
    63
	gsed -i 's|:$LD_LIBRARY_PATH|:$$LD_LIBRARY_PATH|g' $BUILD_DIR/src/tests/test$i
cdf29f584705 23528052 libpki's configure and Makefile need refactoring
naoki.tanaka@oracle.com <naoki.tanaka@oracle.com>
parents: 5897
diff changeset
    64
done