diff options
author | Leo Neat <leosneat@gmail.com> | 2020-01-15 13:30:57 -0800 |
---|---|---|
committer | jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com> | 2020-01-15 13:30:57 -0800 |
commit | 14582175d07c8a66adf3f9087a464612f2a3f630 (patch) | |
tree | 831d57d5a406af6be2dcb3bd0ca7ba1970956cea /infra/bisector_test.py | |
parent | 79860344beaf5b228c0f619451d860ec0f2adcfa (diff) | |
download | oss-fuzz-14582175d07c8a66adf3f9087a464612f2a3f630.tar.gz |
[infra] Scripts for building fuzzers with CIFuzz (#3207)
Diffstat (limited to 'infra/bisector_test.py')
-rw-r--r-- | infra/bisector_test.py | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/infra/bisector_test.py b/infra/bisector_test.py index 1644e8faa..a758d30fe 100644 --- a/infra/bisector_test.py +++ b/infra/bisector_test.py @@ -11,27 +11,31 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing perepo_managerissions and # limitations under the License. -"""Test the functionality of bisection module. -1) Test a known case where an error appears in a regression range -2) Bisect can handle incorrect inputs +"""Test the functionality of bisection module: +1) Test a known case where an error appears in a regression range. +2) Bisect can handle incorrect inputs. """ import os import unittest import bisector +import build_specified_commit # Necessary because __file__ changes with os.chdir TEST_DIR_PATH = os.path.dirname(os.path.realpath(__file__)) class TestBisect(unittest.TestCase): - """Class to test the functionality of bisection method""" + """Class to test the functionality of bisection method.""" def test_bisect_invalid_repo(self): - """Test the bisection method on a project that does not exist""" - build_data = bisector.BuildData('not-a-real-repo', 'libfuzzer', 'address', - 'x86_64') + """Test the bisection method on a project that does not exist.""" + build_data = build_specified_commit.BuildData() + build_data.project_name = 'not-a-real-repo' + build_data.engine = 'libfuzzer' + build_data.sanitizer = 'address' + build_data.architecture = 'x86_64' commit_old = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' commit_new = 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' testcase = os.path.join(TEST_DIR_PATH, 'testcases', 'usrsctp_test_data') @@ -41,7 +45,11 @@ class TestBisect(unittest.TestCase): def test_bisect_curl(self): """Test the bisect method on the curl project.""" - build_data = bisector.BuildData('curl', 'libfuzzer', 'address', 'x86_64') + build_data = build_specified_commit.BuildData() + build_data.project_name = 'curl' + build_data.engine = 'libfuzzer' + build_data.sanitizer = 'address' + build_data.architecture = 'x86_64' commit_new = 'dda418266c99ceab368d723facb52069cbb9c8d5' commit_old = 'df26f5f9c36e19cd503c0e462e9f72ad37b84c82' fuzz_target = 'curl_fuzzer_ftp' @@ -52,8 +60,11 @@ class TestBisect(unittest.TestCase): def test_bisect_libarchive(self): """Test the bisect method on libarchive.""" - build_data = bisector.BuildData('libarchive', 'libfuzzer', 'undefined', - 'x86_64') + build_data = build_specified_commit.BuildData() + build_data.project_name = 'libarchive' + build_data.engine = 'libfuzzer' + build_data.sanitizer = 'address' + build_data.architecture = 'x86_64' commit_new = '458e49358f17ec58d65ab1c45cf299baaf3c98d1' commit_old = '5bd2a9b6658a3a6efa20bb9ad75bd39a44d71da6' fuzz_target = 'libarchive_fuzzer' @@ -64,7 +75,11 @@ class TestBisect(unittest.TestCase): def test_bisect_usrsctp(self): """Test the bisect method on the usrsctp.""" - build_data = bisector.BuildData('usrsctp', 'libfuzzer', 'address', 'x86_64') + build_data = build_specified_commit.BuildData() + build_data.project_name = 'usrsctp' + build_data.engine = 'libfuzzer' + build_data.sanitizer = 'address' + build_data.architecture = 'x86_64' commit_old = '4886aaa49fb90e479226fcfc3241d74208908232' commit_new = 'c710749b1053978179a027973a3ea3bccf20ee5c' testcase = os.path.join(TEST_DIR_PATH, 'testcases', 'usrsctp_test_data') @@ -75,7 +90,11 @@ class TestBisect(unittest.TestCase): def test_bisect_usrsctp_single_error_exists(self): """Tests what happens with a single with an error.""" - build_data = bisector.BuildData('usrsctp', 'libfuzzer', 'address', 'x86_64') + build_data = build_specified_commit.BuildData() + build_data.project_name = 'usrsctp' + build_data.engine = 'libfuzzer' + build_data.sanitizer = 'address' + build_data.architecture = 'x86_64' commit_old = 'c710749b1053978179a027973a3ea3bccf20ee5c' commit_new = 'c710749b1053978179a027973a3ea3bccf20ee5c' testcase = os.path.join(TEST_DIR_PATH, 'testcases', 'usrsctp_test_data') @@ -86,7 +105,11 @@ class TestBisect(unittest.TestCase): def test_bisect_usrsctp_single_no_error_exists(self): """Tests what happens with a single with an error.""" - build_data = bisector.BuildData('usrsctp', 'libfuzzer', 'address', 'x86_64') + build_data = build_specified_commit.BuildData() + build_data.project_name = 'usrsctp' + build_data.engine = 'libfuzzer' + build_data.sanitizer = 'address' + build_data.architecture = 'x86_64' commit_old = '4886aaa49fb90e479226fcfc3241d74208908232' commit_new = '4886aaa49fb90e479226fcfc3241d74208908232' testcase = os.path.join(TEST_DIR_PATH, 'testcases', 'usrsctp_test_data') |