Perform an oslo-sync
Removed run_cross_tests from openstack-common.conf Removed all of oslo_policy/openstack/common Performed sync from latest master of oslo-incubator Undid the delete to oslo_policy/openstack/common/_i18n.py since it is still required, until we move to oslo.i18n. oslo-incubator was at commit level: 9a1970b3708114cc52f89a7b4d048eeae9140fef Change-Id: I55288e618b268b73012784481c00285195edbf3b
This commit is contained in:
parent
ce2839f832
commit
919b1b7fa9
@ -1,7 +1,6 @@
|
|||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
|
|
||||||
# The list of modules to copy from oslo-incubator.git
|
# The list of modules to copy from oslo-incubator.git
|
||||||
script = tools/run_cross_tests.sh
|
|
||||||
modules=fileutils
|
modules=fileutils
|
||||||
|
|
||||||
# The base module to hold the copy of openstack.common
|
# The base module to hold the copy of openstack.common
|
||||||
|
@ -17,6 +17,7 @@ import contextlib
|
|||||||
import errno
|
import errno
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import stat
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from oslo.utils import excutils
|
from oslo.utils import excutils
|
||||||
@ -24,15 +25,17 @@ from oslo.utils import excutils
|
|||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
_FILE_CACHE = {}
|
_FILE_CACHE = {}
|
||||||
|
DEFAULT_MODE = stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO
|
||||||
|
|
||||||
|
|
||||||
def ensure_tree(path):
|
def ensure_tree(path, mode=DEFAULT_MODE):
|
||||||
"""Create a directory (and any ancestor directories required)
|
"""Create a directory (and any ancestor directories required)
|
||||||
|
|
||||||
:param path: Directory to create
|
:param path: Directory to create
|
||||||
|
:param mode: Directory creation permissions
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
os.makedirs(path)
|
os.makedirs(path, mode)
|
||||||
except OSError as exc:
|
except OSError as exc:
|
||||||
if exc.errno == errno.EEXIST:
|
if exc.errno == errno.EEXIST:
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
# Copyright 2011 OpenStack Foundation.
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
||||||
# not use this file except in compliance with the License. You may obtain
|
|
||||||
# a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
# License for the specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
|
|
||||||
"""Local storage of variables using weak references"""
|
|
||||||
|
|
||||||
import threading
|
|
||||||
import weakref
|
|
||||||
|
|
||||||
|
|
||||||
class WeakLocal(threading.local):
|
|
||||||
def __getattribute__(self, attr):
|
|
||||||
rval = super(WeakLocal, self).__getattribute__(attr)
|
|
||||||
if rval:
|
|
||||||
# NOTE(mikal): this bit is confusing. What is stored is a weak
|
|
||||||
# reference, not the value itself. We therefore need to lookup
|
|
||||||
# the weak reference and return the inner value here.
|
|
||||||
rval = rval()
|
|
||||||
return rval
|
|
||||||
|
|
||||||
def __setattr__(self, attr, value):
|
|
||||||
value = weakref.ref(value)
|
|
||||||
return super(WeakLocal, self).__setattr__(attr, value)
|
|
||||||
|
|
||||||
|
|
||||||
# NOTE(mikal): the name "store" should be deprecated in the future
|
|
||||||
store = WeakLocal()
|
|
||||||
|
|
||||||
# A "weak" store uses weak references and allows an object to fall out of scope
|
|
||||||
# when it falls out of scope in the code that uses the thread local storage. A
|
|
||||||
# "strong" store will hold a reference to the object so that it never falls out
|
|
||||||
# of scope.
|
|
||||||
weak_store = WeakLocal()
|
|
||||||
strong_store = threading.local()
|
|
@ -1,91 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Run cross-project tests
|
|
||||||
#
|
|
||||||
# Usage:
|
|
||||||
#
|
|
||||||
# run_cross_tests.sh project_dir venv
|
|
||||||
|
|
||||||
# Fail the build if any command fails
|
|
||||||
set -e
|
|
||||||
|
|
||||||
project_dir="$1"
|
|
||||||
venv="$2"
|
|
||||||
|
|
||||||
if [ -z "$project_dir" -o -z "$venv" ]
|
|
||||||
then
|
|
||||||
cat - <<EOF
|
|
||||||
ERROR: Missing argument(s)
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
|
|
||||||
$0 PROJECT_DIR VIRTUAL_ENV
|
|
||||||
|
|
||||||
Example, run the python 2.7 tests for python-neutronclient:
|
|
||||||
|
|
||||||
$0 /opt/stack/python-neutronclient py27
|
|
||||||
|
|
||||||
EOF
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Set up the virtualenv without running the tests
|
|
||||||
(cd $project_dir && tox --notest -e $venv)
|
|
||||||
|
|
||||||
tox_envbin=$project_dir/.tox/$venv/bin
|
|
||||||
|
|
||||||
our_name=$(python setup.py --name)
|
|
||||||
|
|
||||||
# Replace the pip-installed package with the version in our source
|
|
||||||
# tree. Look to see if we are already installed before trying to
|
|
||||||
# uninstall ourselves, to avoid failures from packages that do not use us
|
|
||||||
# yet.
|
|
||||||
if $tox_envbin/pip freeze | grep -q $our_name
|
|
||||||
then
|
|
||||||
$tox_envbin/pip uninstall -y $our_name
|
|
||||||
fi
|
|
||||||
$tox_envbin/pip install -U .
|
|
||||||
|
|
||||||
# Run the tests
|
|
||||||
(cd $project_dir && tox -e $venv)
|
|
||||||
result=$?
|
|
||||||
|
|
||||||
|
|
||||||
# The below checks are modified from
|
|
||||||
# openstack-infra/config/modules/jenkins/files/slave_scripts/run-unittests.sh.
|
|
||||||
|
|
||||||
# They expect to be run in the project being tested.
|
|
||||||
cd $project_dir
|
|
||||||
|
|
||||||
echo "Begin pip freeze output from test virtualenv:"
|
|
||||||
echo "======================================================================"
|
|
||||||
.tox/$venv/bin/pip freeze
|
|
||||||
echo "======================================================================"
|
|
||||||
|
|
||||||
# We only want to run the next check if the tool is installed, so look
|
|
||||||
# for it before continuing.
|
|
||||||
if [ -f /usr/local/jenkins/slave_scripts/subunit2html.py -a -d ".testrepository" ] ; then
|
|
||||||
if [ -f ".testrepository/0.2" ] ; then
|
|
||||||
cp .testrepository/0.2 ./subunit_log.txt
|
|
||||||
elif [ -f ".testrepository/0" ] ; then
|
|
||||||
.tox/$venv/bin/subunit-1to2 < .testrepository/0 > ./subunit_log.txt
|
|
||||||
fi
|
|
||||||
.tox/$venv/bin/python /usr/local/jenkins/slave_scripts/subunit2html.py ./subunit_log.txt testr_results.html
|
|
||||||
gzip -9 ./subunit_log.txt
|
|
||||||
gzip -9 ./testr_results.html
|
|
||||||
|
|
||||||
export PYTHON=.tox/$venv/bin/python
|
|
||||||
set -e
|
|
||||||
rancount=$(.tox/$venv/bin/testr last | sed -ne 's/Ran \([0-9]\+\).*tests in.*/\1/p')
|
|
||||||
if [ "$rancount" -eq "0" ] ; then
|
|
||||||
echo
|
|
||||||
echo "Zero tests were run. At least one test should have been run."
|
|
||||||
echo "Failing this test as a result"
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If we make it this far, report status based on the tests that were
|
|
||||||
# run.
|
|
||||||
exit $result
|
|
Loading…
Reference in New Issue
Block a user