26 Commits
Author SHA1 Message Date
Matthew Johnson 32aa9c70ff Ignore bare excepts with flake8
The previous ignore, import not at top of file (E402) was unneeded. Bare
excepts are handy when we want to fail gracefully from any error. This
is a script, not an imported library.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-10-23 12:08:01 -07:00
Matthew Johnson 2552c9786f Move test generators out of name guard
This allows python3 unittest to properly generate the tests when running
all the tests in the tests directory.

Also adds a fix to test_test.py to reset buildpattern.default_pattern
every test. This was a bug introduced by running all tests at once -
this was not being cleared correctly.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-09-26 15:30:34 -07:00
William Douglas 57280362e0 Add travis config 2017-09-22 15:20:17 -07:00
Matthew Johnson d200c719d7 Add simple unit tests for the util module 2017-07-13 09:14:45 -07:00
Matthew Johnson 9f1e14a06c Manually run each unit test suite in Makefile
The unittest discover method did not run any code within the
if __name__ == "__main__": guard, which prevented it from picking up
generated tests for some of our large pattern-based tests. Just run them
manually so we can actually see all the tests being run.
2017-07-13 09:14:45 -07:00
Matthew Johnson 99b9ed6dd5 Add unit tests for the test module
This patch adds unit tests for the test module.
2017-07-12 08:46:47 -07:00
Matthew Johnson 9f023f87eb Add unit tests for count.py
Add unit tests for the very large count.py module/script. These unit
tests attempt to test every regular expression present in the parse_log
function and helped catch several bugs in the original regexes ported
from perl.
2017-07-11 14:16:55 -07:00
Matthew Johnson e8efee61dc Add unit tests for the specdescription module
Unit tests added for the specdescription module. At the time of this
commit, there are two failing tests due to bugs in the module.

Failures:

- test_description_from_pkginfo

  This test fails because a string.find() method is checked as a boolean
  as if find returned 0 if the substring was not present. find()
  actually returns -1 in this case. Because find() was being used as a
  guard to find the end of a section, the end was found immediately and
  the section was not parsed.

- test_description_from_spec_no_info

  This test fails due to the default description being overridden, even
  when the override is just an empty string.
2017-07-07 12:34:30 -07:00
Matthew Johnson d5b6abc9d2 Add unittests for the buildreq module
Unit tests can be run from the root of the autospec directory by
invoking `make test_buildreq` or `make unittests`.
2017-05-01 11:47:00 -07:00
Matthew Johnson 13c6cdd838 Add unittests for the build module
This patch adds 26 tests for the build module. They can be tested by
running `make test_build` from the root of the autospec repo.
2017-04-25 16:55:07 -07:00
Matthew Johnson 11569333b4 Add simple tests for buildpattern module
The complexity of the buildpattern has been significantly reduced with
the move to a centralized specfiles class to handle specfile writes.
This patch tests the remaining functionality and fixes a typo in
buildpattern.py (pattern_strengh -> pattern_strength).
2017-04-25 14:48:33 -07:00
Matthew Johnson 0c51d2697c Use Make ${CURDIR} instead of invoking pwd at runtime 2017-04-03 20:36:12 -07:00
Matthew Johnson 5a805b704a Refactor and test the license module
Several changes to the license module including changes to where local
hashes are stored. Tests were added as well. Detailed changes below.

config:
  - Move the license hashes from an internal repo to a config file
    (license_hashes) in autospec.

test_license:
  - Unit tests added
  - Unit test target added to autospec Makefile
  - COPYING_TEST file added with GPL-3.0 text for test purposes

license:
  - scan_for_licenses: separate out search strings from conditional to
    make the code more readable and remove unused parameter (required a
    change to where autospec.py called the function).
  - remove duplicate licenses from license_translation list.
  - convert license_blacklist dict to list (values were unused, it was
    being treated as a list anyways).
  - separate out search strings from code in license_from_copying_hash
    and license_from_doc.
  - move curl code out of `with open(file) as fname:` clause in
    license_from_copying_hash.
2017-04-03 20:36:12 -07:00
Matthew Johnson d497f7e2cb files: general cleanup of module
The files module was being treated like a class, in that it was
necessary to keep state throughout the entire autospec run. Convert the
files module to a class and make some other general clean ups. This
changed how the files module was instantiated and called by the main
autospec module and other modules such as tarball and config.

Test the files module with unit tests and add the target to the
makefile.
2017-03-28 22:35:11 -07:00
Matthew Johnson 192ee3570d Add unit tests for commitmessage module 2017-02-16 15:35:35 -08:00
Matthew Johnson 101b2f74bb Add unit tests for abireport
Tests most helper functions in the abireport module. Excludes some
helpers that are just wrappers for os and shutil calls. Also excludes
the 100-line examine_abi main method, which may require functional
tests.
2017-01-24 15:01:38 -08:00
Matthew Johnson 13dc417c0a Add arguments to only run specific functional tests
Functional tests take a long time to run, some longer than others. This
adds the option to run specific test cases defined by passing
whitespace-separated options to the '-c' flag, allowing the tester to
avoid long-running tests like libjpeg-turbo if they don't need to. This
can be run with make by setting the CASES argument:

make test_autospec CASES="c-helloworld c-helloworld-32"
2017-01-19 11:38:56 -08:00
Matthew Johnson 5407d741be Import refactor of pkg_integrity tests
Since pkg_integrity now depends on config.py, it is necessary to change
how imports are done in the tests so mocking can be achieved. This also
required renaming the tests/pkg_integrity.py file to
tests/test_pkg_integrity.py to avoid a name collision. Before each test
the necessary config option is set correctly and the configuration file
rewrite is mocked away.
2017-01-07 08:38:28 -08:00
Matthew Johnson e34771c7a9 Use epoch time for reproducible build env variable
Instead of using the date the configure file was modified, use the UNIX
epoch time for the SOURCE_DATE_EPOCH environment variable. This allows
reproducible package binaries per autospec build.

Functional tests updated to match change and 'unittest' make target
added to ease testing.
2016-12-27 13:05:39 -08:00
Matthew Johnson 4dcb271dac Add unit tests for new Specfile class
Includes a rename of specfile.py -> specfiles.py for easier imports and
related change to how it imported in autospec.py. Also includes a minor
fix to how lang files are written to the specfile. The error was
identified by these unit tests.
2016-12-16 12:40:20 -08:00
Matthew Johnson e0111cc30e Add a unit test for version detection
This unit test reads test cases from tests/packageurls and attempts to
determine the version and name from the url specified. tests/packageurls
defines these cases and their expected results in the format:

<package url>,<expected name>,<expected version>

There are currently some test cases that fail. This unit test will make
it easier to make changes to the tarball.name_and_version() function.
2016-12-14 15:06:35 -08:00
Matthew Johnson 90b3942927 Standardize testing invocation and structure
This involves moving the tests to the top-level tests/ directory, adding
a Makefile target (make test_autospec) to run the functional tests, and
adding a tests/README.rst to explain the various testing files and test
structure.
2016-11-28 14:57:40 -08:00
Alex Jaramillo d56b7189a5 Changing module name
Signature verification was extended to do hash
validation for ruby gems, so integrity validation
is a better description of module. The module
was changed from verify_sign to pkg_integrity
2016-11-16 18:33:28 +00:00
Alex Jaramillo 3f194a5c1c Adding unittests for verify sign 2016-11-15 00:43:45 +00:00
Simental Magana, Marcos 2a7ba09747 Fix Makefile to check autospec/*.py
autospec code was moved into autospec/ folder and current
Makefile does not check it, this commit changes the check
target to run flake8 in autospec/*.py instead of ./*.py
2015-12-21 14:21:51 -06:00
Ikey Doherty f548853a31 Initial commit
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
2015-11-06 17:30:13 +00:00