Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:
run: make check-tools

- name: Test with pytest
run: PYTHONPATH=./bin pytest --cov=./ --cov-report=xml dfxml
run: pytest --cov=dfxml --cov-report=xml .
20 changes: 4 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,15 @@ all:

clean:
find . -name '*~' -exec rm {} \;
(cd tests;make clean)
(cd dfxml/bin;make clean)
(cd dfxml/tests;make clean)
$(MAKE) \
--directory tests \
clean

check: .git_submodule_init.done.log
$(MAKE) \
SHELL=$(SHELL) \
--directory tests \
check
source tests/venv/bin/activate \
&& mypy \
dfxml/tests
source tests/venv/bin/activate \
&& pytest \
--log-level=DEBUG \
dfxml/tests

check-tools:
(cd dfxml/bin;make check)
@echo performing checks currently in Travis

check-core:
cd dfxml
PYTHONPATH=./bin python3 -m pytest dfxml
(cd tests/misc_object_tests;make check)
96 changes: 0 additions & 96 deletions dfxml/tests/Makefile

This file was deleted.

21 changes: 0 additions & 21 deletions dfxml/tests/cat_patterns_test.sh

This file was deleted.

3 changes: 0 additions & 3 deletions dfxml/tests/paths.sh

This file was deleted.

13 changes: 8 additions & 5 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ check-mypy: \
&& mypy \
../dfxml/bin/idifference.py \
../dfxml/bin/summarize_differential_dfxml.py \
../dfxml/bin/tests \
../dfxml/__init__.py \
../dfxml/objects.py \
../dfxml/tests
misc_bin_tests \
misc_object_tests
@echo "INFO:tests/Makefile:mypy is currently run against a subset of the dfxml directory." >&2

#TODO - Strict type-checking is another long-term goal, likewise eventually done against all of ../dfxml.
Expand All @@ -92,14 +92,17 @@ check-mypy-strict: \
source venv/bin/activate \
&& mypy \
--strict \
. \
../dfxml/bin/idifference2.py \
../dfxml/bin/make_differential_dfxml.py \
../dfxml/bin/walk_to_dfxml.py \
../dfxml/tests/FileObject_test.py \
../dfxml/tests/storage_layers_test.py
make_differential_dfxml \
walk_to_dfxml \
*.py

clean:
@$(MAKE) \
--directory misc_object_tests \
clean
@$(MAKE) \
--directory make_differential_dfxml \
clean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Files with modified contents:
i_will_be_modified.txt mtime changed, 2013-01-01T00:00:00Z -> 2013-05-16T20:59:00Z
i_will_be_modified.txt atime changed, 2013-01-01T00:00:00Z -> 2013-05-16T20:59:00Z
i_will_be_modified.txt ctime changed, 2013-01-01T00:00:00Z -> 2013-05-16T20:59:00Z
i_will_be_modified.txt data_brs changed, ByteRuns(run_list=[ByteRun(img_offset=234512, len=22, file_offset=0)]) ByteRuns(run_list=[ByteRun(img_offset=234512, len=23, file_offset=0)])
i_will_be_modified.txt data_brs changed, ByteRuns(run_list=[ByteRun(img_offset=234512, file_offset=0, len=22)]) ByteRuns(run_list=[ByteRun(img_offset=234512, file_offset=0, len=23)])
i_will_be_modified.txt filesize changed, 22 23
i_will_be_modified.txt md5 changed, e91577092351461d7800ef7b870a2bcf a6d9ebd95bcd3602b757ea63f9dd02ab
i_will_be_modified.txt sha1 changed, 44e426344f15bd7621ca2f9ffea70d29752dccda 1e087807678a33ebbde2624341184c14303675a3
Expand All @@ -31,4 +31,4 @@ Files with changed properties:
==============================

i_will_be_accessed.txt atime changed, 2013-01-01T00:00:00Z -> 2013-05-16T21:00:00Z
i_will_be_accessed.txt data_brs changed, ByteRuns(run_list=[ByteRun(img_offset=34512, len=12, file_offset=0)]) ByteRuns(run_list=[ByteRun(img_offset=234512, len=12, file_offset=0)])
i_will_be_accessed.txt data_brs changed, ByteRuns(run_list=[ByteRun(img_offset=34512, file_offset=0, len=12)]) ByteRuns(run_list=[ByteRun(img_offset=234512, file_offset=0, len=12)])
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Files with modified contents:
i_will_be_modified.txt mtime changed, 2013-01-01T00:00:00Z -> 2013-05-16T20:59:00Z
i_will_be_modified.txt atime changed, 2013-01-01T00:00:00Z -> 2013-05-16T20:59:00Z
i_will_be_modified.txt ctime changed, 2013-01-01T00:00:00Z -> 2013-05-16T20:59:00Z
i_will_be_modified.txt data_brs changed, ByteRuns(run_list=[ByteRun(len=22, img_offset=234512, file_offset=0)]) ByteRuns(run_list=[ByteRun(len=23, img_offset=234512, file_offset=0)])
i_will_be_modified.txt data_brs changed, ByteRuns(run_list=[ByteRun(img_offset=234512, file_offset=0, len=22)]) ByteRuns(run_list=[ByteRun(img_offset=234512, file_offset=0, len=23)])
i_will_be_modified.txt filesize changed, 22 23
i_will_be_modified.txt md5 changed, e91577092351461d7800ef7b870a2bcf a6d9ebd95bcd3602b757ea63f9dd02ab
i_will_be_modified.txt sha1 changed, 44e426344f15bd7621ca2f9ffea70d29752dccda 1e087807678a33ebbde2624341184c14303675a3
Expand All @@ -31,4 +31,4 @@ Files with changed properties:
==============================

i_will_be_accessed.txt atime changed, 2013-01-01T00:00:00Z -> 2013-05-16T21:00:00Z
i_will_be_accessed.txt data_brs changed, ByteRuns(run_list=[ByteRun(len=12, img_offset=34512, file_offset=0)]) ByteRuns(run_list=[ByteRun(len=12, img_offset=234512, file_offset=0)])
i_will_be_accessed.txt data_brs changed, ByteRuns(run_list=[ByteRun(img_offset=34512, file_offset=0, len=12)]) ByteRuns(run_list=[ByteRun(img_offset=234512, file_offset=0, len=12)])
1 change: 1 addition & 0 deletions tests/misc_bin_tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The tests in this directory needed to be moved to address a new behavior in a deployed static type checker. The intent is to empty this directory, moving its tests to appropriate locations under `/tests`.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import py.test

from dfxml import *

def check_equal(a,b,want=None):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import sys
import os
import py.test

from dfxml.bin.iexport import *

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
91 changes: 91 additions & 0 deletions tests/misc_object_tests/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/usr/bin/make -f

# This software was developed at the National Institute of Standards
# and Technology in whole or in part by employees of the Federal
# Government in the course of their official duties. Pursuant to
# title 17 Section 105 of the United States Code portions of this
# software authored by NIST employees are not subject to copyright
# protection and are in the public domain. For portions not authored
# by NIST employees, NIST has been granted unlimited rights. NIST
# assumes no responsibility whatsoever for its use by other parties,
# and makes no guarantees, expressed or implied, about its quality,
# reliability, or any other characteristic.
#
# We would appreciate acknowledgement if the software is used.

# Bash selection is described in the top-level Makefile.
ifeq ($(shell basename $(SHELL)),sh)
SHELL := $(shell which /bin/bash 2>/dev/null || which /usr/local/bin/bash)
endif

top_srcdir := $(shell cd ../.. ; pwd)

PYTHON3 ?= python3

OBJECTS := $(top_srcdir)/dfxml/objects.py

SAMPLES_DIR := $(top_srcdir)/samples

TOOLS_DIR := $(top_srcdir)/dfxml/bin

all: \
check

.PHONY: \
check-diff_file_ignore-py3 \
check-versioned

check: \
check-diff_file_ignore-py3 \
check-libraries-py3 \
check-versioned
source $(top_srcdir)/tests/venv/bin/activate \
&& $(PYTHON3) "$(TOOLS_DIR)/cat_partitions.py" \
12345678:$(SAMPLES_DIR)/difference_test_0.xml \
87654321:$(SAMPLES_DIR)/difference_test_1.xml \
> __cat_patterns_test.sh.dfxml
xmllint \
--format \
__cat_patterns_test.sh.dfxml \
> _cat_patterns_test.sh.dfxml
rm \
__cat_patterns_test.sh.dfxml
mv \
_cat_patterns_test.sh.dfxml \
cat_patterns_test.sh.dfxml

check-diff_file_ignore-py3: \
diff_file_ignore_sample-py3.dfxml \
diff_file_ignore_test.py
source $(top_srcdir)/tests/venv/bin/activate \
&& $(PYTHON3) diff_file_ignore_test.py --debug diff_file_ignore_sample-py3.dfxml

check-libraries-py3:
source $(top_srcdir)/tests/venv/bin/activate \
&& $(PYTHON3) LibraryObject_write_test.py LibraryObject_py3_test.dfxml
source $(top_srcdir)/tests/venv/bin/activate \
&& $(PYTHON3) LibraryObject_read_test.py LibraryObject_py3_test.dfxml

check-versioned:
$(PYTHON3) $(OBJECTS)
source $(top_srcdir)/tests/venv/bin/activate \
&& $(PYTHON3) DFXMLObject_program_test.py \
$(SAMPLES_DIR)/difference_test_0.xml \
vi \
8.0

clean:
rm -f difference_counts_test.py-d*
rm -f cat_partitions_test.sh.dfxml
rm -f diff_file_ignore_sample-py3.dfxml
rm -f LibraryObject_py3_test.dfxml
rm -f *~


diff_file_ignore_sample-py3.dfxml: \
$(OBJECTS) \
diff_file_ignore_sample_dfxml_test.py
rm -f _$@
source $(top_srcdir)/tests/venv/bin/activate \
&& $(PYTHON3) diff_file_ignore_sample_dfxml_test.py --debug _$@
mv _$@ $@
File renamed without changes.
1 change: 1 addition & 0 deletions tests/misc_object_tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The tests in this directory needed to be moved to address a new behavior in a deployed static type checker. The intent is to empty this directory, moving its tests to appropriate locations under `/tests`.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

import dfxml.objects as Objects

def test_all():
import diffing_CellObject_test
import diffing_HiveObject_test
import diffing_CellObject_test
import diffing_HiveObject_test

def test_all():
ro = Objects.RegXMLObject(version="0.2")
ho = Objects.HiveObject()
ho.append(diffing_CellObject_test.get_co())
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.