11#! /bin/sh -xe
22
3+ if [ $# -ne 3 ]; then
4+ echo >&2 " Usage: $0 OS_VERSION XRD_CACHE PYTHON_VERSION"
5+ exit 2
6+ fi
37OS_VERSION=$1
48XRD_CACHE=$2
9+ PYTHON_VERSION=$3
510
611ls -l /home
712
813# Clean the yum cache
914yum -y clean all
10- yum -y clean expire-cache
1115
1216# First, install all the needed packages.
1317rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-${OS_VERSION} .noarch.rpm
1418
15- yum -y install yum-plugin-priorities
1619case $OS_VERSION in
17- 6) OSG_VERSION=3.4
20+ 6) OSG_VERSION=3.4
21+ yum -y install yum-plugin-priorities
22+ ;;
23+ 7) OSG_VERSION=3.5
24+ yum -y install yum-plugin-priorities
1825 ;;
19- 7|8) OSG_VERSION=3.5
26+ 8) OSG_VERSION=3.5
27+ # no priorities
2028 ;;
2129esac
2230rpm -Uvh https://repo.opensciencegrid.org/osg/${OSG_VERSION} /osg-${OSG_VERSION} -el${OS_VERSION} -release-latest.rpm
2331
2432yum -y install osg-oasis
2533
26- yum -y install python-pip
34+
35+ case $PYTHON_VERSION in
36+ 2)
37+ pip=pip2
38+ python=python2
39+ if [ " $OS_VERSION " -eq 6 ]; then
40+ yum -y install python-setuptools
41+ export PYTHONDONTWRITEBYTECODE=
42+ easy_install ' pip==9'
43+ else
44+ yum -y install python2-pip
45+ fi
46+ ;;
47+ 3)
48+ yum -y install python3-pip
49+ pip=pip3
50+ python=python3
51+ ;;
52+ esac
2753
2854echo " user_allow_other" >> /etc/fuse.conf
2955
@@ -46,29 +72,31 @@ module load xrootd
4672# pylint /StashCache/bin/stashcp || /bin/true
4773
4874# Install stashcp
49- pip install StashCache/
75+ $pip install StashCache/
76+
77+ stashcp=$( command -v stashcp)
5078
5179# Copy in the .job.ad file:
5280cp /StashCache/bin/stashcp2/tests/job.ad ./.job.ad
5381
5482# Test against a file that is known to not exist
5583set +e
56- stashcp --cache=$XRD_CACHE /blah/does/not/exist ./
84+ $python $ stashcp --cache=$XRD_CACHE /blah/does/not/exist ./
5785if [ $? -eq 0 ]; then
5886 echo " Failed to exit with non-zero exit status when it should have"
5987 exit 1
6088fi
6189set -e
6290
6391# Try copying with no forward slash
64- stashcp --cache=$XRD_CACHE osgconnect/public/dweitzel/blast/queries/query1 ./
92+ $python $ stashcp --cache=$XRD_CACHE osgconnect/public/dweitzel/blast/queries/query1 ./
6593
6694result=` md5sum query1 | awk ' {print $1;}' `
6795
6896rm query1
6997
7098# Try copying with different destintion filename
71- stashcp --cache=$XRD_CACHE -d /osgconnect/public/dweitzel/blast/queries/query1 query.test
99+ $python $ stashcp --cache=$XRD_CACHE -d /osgconnect/public/dweitzel/blast/queries/query1 query.test
72100
73101result=` md5sum query.test | awk ' {print $1;}' `
74102
79107rm -f query.test
80108
81109# Perform tests
82- stashcp --cache=$XRD_CACHE -d /osgconnect/public/dweitzel/blast/queries/query1 ./
110+ $python $ stashcp --cache=$XRD_CACHE -d /osgconnect/public/dweitzel/blast/queries/query1 ./
83111
84112result=` md5sum query1 | awk ' {print $1;}' `
85113
89117rm -f query.test
90118
91119# Perform methods test
92- stashcp --cache=$XRD_CACHE --method=cvmfs,xrootd -d /osgconnect/public/dweitzel/blast/queries/query1 ./
120+ $python $ stashcp --cache=$XRD_CACHE --method=cvmfs,xrootd -d /osgconnect/public/dweitzel/blast/queries/query1 ./
93121
94122result=` md5sum query1 | awk ' {print $1;}' `
95123
99127rm -f query.test
100128
101129# Perform methods test
102- stashcp --cache=$XRD_CACHE --method=xrootd -d /osgconnect/public/dweitzel//blast/queries/query1 ./
130+ $python $ stashcp --cache=$XRD_CACHE --method=xrootd -d /osgconnect/public/dweitzel//blast/queries/query1 ./
103131
104132result=` md5sum query1 | awk ' {print $1;}' `
105133
109137rm -f query.test
110138
111139# Perform methods test
112- stashcp --cache=$XRD_CACHE --method=http,xrootd -d /osgconnect/public/dweitzel/blast/queries/query1 ./
140+ $python $ stashcp --cache=$XRD_CACHE --method=http,xrootd -d /osgconnect/public/dweitzel/blast/queries/query1 ./
113141
114142result=` md5sum query1 | awk ' {print $1;}' `
115143
119147rm -f query.test
120148
121149# Scheme test
122- stashcp --cache=$XRD_CACHE --method=http,xrootd -d stash:///osgconnect/public/dweitzel/blast/queries/query1 file:///tmp
150+ $python $ stashcp --cache=$XRD_CACHE --method=http,xrootd -d stash:///osgconnect/public/dweitzel/blast/queries/query1 file:///tmp
123151
124152result=` md5sum /tmp/query1 | awk ' {print $1;}' `
125153
@@ -128,7 +156,7 @@ if [ "$result" != "12bdb9a96cd5e8ca469b727a81593201" ]; then
128156fi
129157rm -f query.test
130158
131- stashcp --cache=$XRD_CACHE -d -r /osgconnect/public/dweitzel/blast/queries ./
159+ $python $ stashcp --cache=$XRD_CACHE -d -r /osgconnect/public/dweitzel/blast/queries ./
132160ls -lah
133161
134162rm -rf queries
0 commit comments