From 882cda798cff0b777a4ab991e78e38f7d70f95bf Mon Sep 17 00:00:00 2001 From: Alex Groce Date: Thu, 12 Jul 2018 22:01:58 -0700 Subject: [PATCH] Check results for pass/fail on properties, split into angr and manticore tests --- .travis.yml | 7 +++++-- tests/test_basic_functionality.py | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 tests/test_basic_functionality.py diff --git a/.travis.yml b/.travis.yml index 89c74e5..a411ba5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,14 @@ python: - "2.7" install: - sudo apt-get update -- sudo apt-get install build-essential gcc-multilib cmake python python-setuptools libffi-dev z3 +- sudo apt-get install build-essential gcc-multilib cmake python python-setuptools libffi-dev - mkdir build - cd build - cmake .. - make - python setup.py install +env: +- TASK=ANGR DEEPSTATE_CMD=deepstate-angr +- TASK=MANTICORE DEEPSTATE_CMD=deepstate-manticore script: -- deepstate-manticore examples/IntegerArithmetic +- nosetests --verbose diff --git a/tests/test_basic_functionality.py b/tests/test_basic_functionality.py new file mode 100644 index 0000000..e811d64 --- /dev/null +++ b/tests/test_basic_functionality.py @@ -0,0 +1,22 @@ +from __future__ import print_function +import os +import subprocess +import glob +from unittest import TestCase + + +class TestBasicFunctionality(TestCase): + def test_basic_functionality(self): + deepstate = os.getenv("DEEPSTATE_CMD") + + with open("deepstate.out", 'w') as outf: + r = subprocess.call([deepstate, "examples/IntegerArithmetic"], stdout = outf, stderr = outf) + self.assertEqual(r, 0) + + with open("deepstate.out", 'r') as outf: + result = outf.read() + + self.assertTrue("Passed: Arithmetic_AdditionIsCommutative" in result) + self.assertTrue("Passed: Arithmetic_AdditionIsAssociative" in result) + self.assertTrue("Passed: Arithmetic_InvertibleMultiplication_CanFail" in result) + self.assertTrue("Failed: Arithmetic_InvertibleMultiplication_CanFail" in result)