From 017b5b869a46776b4becc2986828e99acb2b19d9 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 7 Aug 2017 12:12:33 +0100 Subject: [PATCH] trivial: Remove files from 'tools' Two files are removed. 'ebtables.workaround' was required for libvirt < 1.2.11 for the reasons described in the file itself. We no longer support this version of libvirt, thus, the workaround can be removed. 'regression_tester' is a tool for running tests in a patch against old code, to ensure the tests validate what the patch is supposed to be fixing. This is unmaintained and is not referenced anywhere, and should therefore be removed as it's likely bitrotted (or will do so). Change-Id: Iac7f16ff4c178b5e71b786c332ca46a78bef5e3c TrivialFix --- tools/ebtables.workaround | 35 ------------ tools/regression_tester.py | 109 ------------------------------------- 2 files changed, 144 deletions(-) delete mode 100644 tools/ebtables.workaround delete mode 100644 tools/regression_tester.py diff --git a/tools/ebtables.workaround b/tools/ebtables.workaround deleted file mode 100644 index 4c1d8ed81b08..000000000000 --- a/tools/ebtables.workaround +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# Copyright 2015 Hewlett-Packard Development Company, L.P. -# -# 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. -# -# -# This is a terrible, terrible, truly terrible work around for -# environments that have libvirt < 1.2.11. ebtables requires that you -# specifically tell it you would like to not race and get punched in -# the face when 2 run at the same time with a --concurrent flag. -# -# INSTALL instructions -# -# * Copy /sbin/ebtables to /sbin/ebtables.real -# * Copy the ebtables.workaround script to /sbin/ebtables -# -# Note: upgrades to ebtables will overwrite this work around. If you -# are packaging this file consider putting a trigger in place so that -# the workaround is replaced after ebtables upgrade. -# -# Additional Note: this file can be removed from nova once our libvirt -# minimum is >= 1.2.11. - -flock -w 300 /var/lock/ebtables.nova /sbin/ebtables.real $@ diff --git a/tools/regression_tester.py b/tools/regression_tester.py deleted file mode 100644 index 0dce224b01a3..000000000000 --- a/tools/regression_tester.py +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2013 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. - - -"""Tool for checking if patch contains a regression test. - -By default runs against current patch but can be set to use any gerrit review -as specified by change number (uses 'git review -d'). - -Idea: take tests from patch to check, and run against code from previous patch. -If new tests pass, then no regression test, if new tests fails against old code -then either -* new tests depend on new code and cannot confirm regression test is valid - (false positive) -* new tests detects the bug being fixed (detect valid regression test) -Due to the risk of false positives, the results from this need some human -interpretation. -""" - -from __future__ import print_function - -import optparse -import string -import subprocess -import sys - - -def run(cmd, fail_ok=False): - print("running: %s" % cmd) - obj = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - shell=True) - obj.wait() - if obj.returncode != 0 and not fail_ok: - print("The above command terminated with an error.") - sys.exit(obj.returncode) - return obj.stdout.read() - - -def main(): - usage = """ - Tool for checking if a patch includes a regression test. - - Usage: %prog [options]""" - parser = optparse.OptionParser(usage) - parser.add_option("-r", "--review", dest="review", - help="gerrit review number to test") - (options, args) = parser.parse_args() - if options.review: - original_branch = run("git rev-parse --abbrev-ref HEAD") - run("git review -d %s" % options.review) - else: - print("no gerrit review number specified, running on latest commit" - "on current branch.") - - test_works = False - - # run new tests with old code - run("git checkout HEAD^ nova") - run("git checkout HEAD nova/tests") - - # identify which tests have changed - tests = run("git whatchanged --format=oneline -1 | grep \"nova/tests\" " - "| cut -f2").split() - test_list = [] - for test in tests: - test_list.append(string.replace(test[0:-3], '/', '.')) - - if not test_list: - test_works = False - expect_failure = "" - else: - # run new tests, expect them to fail - expect_failure = run(("tox -epy27 %s 2>&1" % string.join(test_list)), - fail_ok=True) - if "FAILED (id=" in expect_failure: - test_works = True - - # cleanup - run("git checkout HEAD nova") - if options.review: - new_branch = run("git status | head -1 | cut -d ' ' -f 4") - run("git checkout %s" % original_branch) - run("git branch -D %s" % new_branch) - - print(expect_failure) - print("") - print("*******************************") - if test_works: - print("FOUND a regression test") - else: - print("NO regression test") - sys.exit(1) - - -if __name__ == "__main__": - main()