Skip to content

Commit 6a738a4

Browse files
authored
Merge pull request sleuthkit#3249 from sleuthkit/test-tsk_loaddb
Test tsk loaddb
2 parents 4a552ac + 6da2f9d commit 6a738a4

File tree

17 files changed

+122
-276
lines changed

17 files changed

+122
-276
lines changed

.github/workflows/build-unix.yml

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -139,23 +139,29 @@ jobs:
139139
MATRIX_ENABLE_JAVA: ${{ matrix.enable_java }}
140140
if: ${{ matrix.os == 'macos' }}
141141
run: |
142+
export CPPFLAGS=-I/opt/homebrew/include/
143+
export LDFLAGS=-L/opt/homebrew/lib/
142144
brew update
143-
brew install libtool autoconf automake libtool libewf libmagic
145+
brew install libtool autoconf automake libtool libewf libmagic afflib
144146
echo MATRIX_ENABLE_JAVA=$MATRIX_ENABLE_JAVA
145147
if [ ${MATRIX_ENABLE_JAVA}x == "yesx" ]; then
146148
echo Installing JAVA
147149
brew install openjdk@17
148-
export JAVA_HOME="$(brew --prefix openjdk)"
149-
export PATH="$JAVA_HOME/bin:$PATH"
150-
export CPPFLAGS="-I$JAVA_HOME/include"
151-
export JNI_CPPFLAGS="-I$JAVA_HOME/include -I$JAVA_HOME/include/darwin"
150+
echo JAVA_HOME="$(brew --prefix openjdk)" >> $GITHUB_ENV
151+
echo PATH="$JAVA_HOME/bin:$PATH" >> $GITHUB_ENV
152+
echo JNI_CPPFLAGS="-I$JAVA_HOME/include -I$JAVA_HOME/include/darwin" >> $GITHUB_ENV
153+
export CPPFLAGS="-I$JAVA_HOME/include $CPPFLAGS"
152154
fi
155+
echo search for aff
156+
find /opt/homebrew -name 'aff*'
157+
echo "CPPFLAGS=$CPPFLAGS" >> $GITHUB_ENV
158+
echo "LDFLAGS=$LDFLAGS" >> $GITHUB_ENV
153159
154160
- name: Install Linux packages
155161
if: ${{ matrix.os == 'linux' }}
156162
run: |
157163
sudo apt update
158-
sudo apt install -y ant autoconf automake g++ libssl-dev libewf-dev libqcow-dev libvhdi-dev libvmdk-dev libmagic-dev libtool make pkg-config zlib1g-dev
164+
sudo apt install -y ant autoconf automake g++ libssl-dev afflib-tools libewf-dev libqcow-dev libvhdi-dev libvmdk-dev libmagic-dev libtool make pkg-config zlib1g-dev
159165
160166
- name: Install Mingw packages and setup for cross-compiling
161167
if: ${{ matrix.os == 'mingw' }}
@@ -179,17 +185,22 @@ jobs:
179185

180186
- name: Run bootstrap
181187
run: |
188+
echo CPPFLAGS=$CPPFLAGS
189+
echo LDFLAGS=$LDFLAGS
182190
./bootstrap
183191
184192
- name: Run configure
185193
run: |
186194
./configure ${{ matrix.configure_opts }}
187195
188-
- name: Get the disk images
196+
- name: Unpack and List the test data
189197
run: |
190-
make test/get_images/test_images.txt
191-
cat test/get_images/test_images.txt
192-
ls -l test/from_brian
198+
cd ..
199+
pwd
200+
git clone https://github.com/sleuthkit/sleuthkit_test_data
201+
cd sleuthkit_test_data
202+
make unpack
203+
find . -ls | grep -v '[.]git'
193204
194205
- name: Run make
195206
run: |
@@ -219,7 +230,7 @@ jobs:
219230
run: |
220231
./configure ${{ matrix.configure_opts }} --enable-address-sanitizer CFLAGS=-g CXXFLAGS=-g
221232
222-
- name: Run make with address-sanitizer
233+
- name: Check with address-sanitizer
223234
if: ${{ matrix.address_sanitizer == 'yes' }}
224235
run: |
225236
make -j check VERBOSE=1
@@ -237,15 +248,15 @@ jobs:
237248
- name: Run make for codecov
238249
if: ${{ matrix.codecov == 'yes' }}
239250
run: |
240-
make -j test/fiwalk/fiwalk_test V=0
241-
make -j test/runner V=0
242-
243-
- name: Run unit tests for codecov
244-
if: ${{ matrix.codecov == 'yes' }}
245-
run: |
246-
test/fiwalk/fiwalk_test -s
247-
test/runner -s
251+
make -j check V=0
252+
#make -j test/fiwalk/fiwalk_test V=0
253+
#make -j test/runner V=0
248254
255+
# - name: Run unit tests for codecov
256+
# if: ${{ matrix.codecov == 'yes' }}
257+
# run: |
258+
# test/fiwalk/fiwalk_test -s
259+
# test/runner -s
249260

250261
- name: run gcov
251262
if: ${{ matrix.codecov == 'yes' }}
@@ -276,10 +287,10 @@ jobs:
276287
executables/*
277288
retention-days: 15
278289

279-
# - name: Run distcheck
280-
# run: |
281-
# ./configure
282-
# make distcheck
283-
#
284-
# - uses: ammaraskar/gcc-problem-matcher@0.2.0
285-
# name: GCC Problem Matcher
290+
- name: Run distcheck
291+
run: |
292+
./configure
293+
make distcheck
294+
295+
- uses: ammaraskar/gcc-problem-matcher@0.2.0
296+
name: GCC Problem Matcher

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,4 @@ venv
207207
wget-log
208208
TAGS
209209
test/from_brian/
210+
*.log

Makefile.am

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ check_script_files = \
634634
test/img_dump/test_imgs_E01.sh \
635635
test/legacy/runtests.sh \
636636
test/tools/tool_differ.sh \
637+
test/tools/autotools/test_loaddb.sh \
637638
test/tools/fstools/test_fls.sh \
638639
test/tools/vstools/test_mmls.sh \
639640
test/tools/vstools/test_mmls_E01.sh
@@ -647,6 +648,7 @@ TESTS = \
647648
test/fiwalk/fiwalk_test \
648649
test/img_dump/test_imgs.sh \
649650
test/legacy/runtests.sh \
651+
test/tools/autotools/test_loaddb.sh \
650652
test/tools/fstools/test_fls.sh \
651653
test/tools/vstools/test_mmls.sh
652654

@@ -697,33 +699,12 @@ test_runner_SOURCES = \
697699
test/runner.cpp \
698700
vendors/catch.hpp
699701

700-
EXTRA_test_runner_DEPENDENCIES = test/get_images/test_images.txt
701-
702702
test_fiwalk_fiwalk_test_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/vendors $(CATCH2_CPPFLAGS)
703703
test_fiwalk_fiwalk_test_LDADD = $(TSK_LIBS)
704704
test_fiwalk_fiwalk_test_SOURCES = \
705705
test/fiwalk/fiwalk_test.cpp \
706706
$(tools_fiwalk_src_libfiwalk_la_SOURCES)
707707

708-
EXTRA_test_fiwalk_fiwalk_test_DEPENDENCIES = test/get_images/test_images.txt
709-
710-
# System for getting test images
711-
# This will be replaced with a sub repo
712-
713-
get_images_inputs = \
714-
test/get_images/get_test_images.bash \
715-
test/get_images/get_test_images.py \
716-
test/get_images/test_images.yaml
717-
718-
test/get_images/test_images.txt: $(get_images_inputs)
719-
bash $(top_srcdir)/test/get_images/get_test_images.bash
720-
721-
EXTRA_DIST += $(get_images_inputs)
722-
723-
##
724-
725-
CLEANFILES += test/get_images/test_images.txt
726-
727708
test_img_dump_img_dump_LDADD = $(TSK_LIBS)
728709
test_img_dump_img_dump_SOURCES = test/img_dump/img_dump.cpp
729710

README.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ the tool or customize it to specific needs.
1515
The Sleuth Kit uses code from the file system analysis tools of
1616
The Coroner's Toolkit (TCT) by Wietse Venema and Dan Farmer. The
1717
TCT code was modified for platform independence. In addition,
18-
support was added for the NTFS (see [wiki/ntfs](http://wiki.sleuthkit.org/index.php?title=NTFS_Implementation_Notes))
18+
support was added for the NTFS (see [wiki/ntfs](http://wiki.sleuthkit.org/index.php?title=NTFS_Implementation_Notes))
1919
and FAT (see [wiki/fat](http://wiki.sleuthkit.org/index.php?title=FAT_Implementation_Notes)) file systems. Previously, The Sleuth Kit was
2020
called The @stake Sleuth Kit (TASK). The Sleuth Kit is now independent
2121
of any commercial or academic organizations.
@@ -34,9 +34,9 @@ The Sleuth Kit allows one to analyze a disk or file system image
3434
created by 'dd', or a similar application that creates a raw image.
3535
These tools are low-level and each performs a single task. When
3636
used together, they can perform a full analysis. For a more detailed
37-
description of these tools, refer to [wiki/filesystem](http://wiki.sleuthkit.org/index.php?title=TSK_Tool_Overview).
37+
description of these tools, refer to [wiki/filesystem](http://wiki.sleuthkit.org/index.php?title=TSK_Tool_Overview).
3838
The tools are briefly described in a file system layered approach. Each
39-
tool name begins with a letter that is assigned to the layer.
39+
tool name begins with a letter that is assigned to the layer.
4040

4141
### File System Layer:
4242
A disk contains one or more partitions (or slices). Each of these
@@ -52,7 +52,7 @@ time, and the details about each "group" in UNIX file systems.
5252
The content layer of a file system contains the actual file content,
5353
or data. Data is stored in large chunks, with names such as blocks,
5454
fragments, and clusters. All tools in this layer begin with the letters
55-
'blk'.
55+
'blk'.
5656

5757
The blkcat tool can be used to display the contents of a specific unit of
5858
the file system (similar to what 'dd' can do with a few arguments).
@@ -75,7 +75,7 @@ descriptive data such as dates and size as well as the addresses of the
7575
data units. This layer describes the file in terms that the computer
7676
can process efficiently. The structures that the data is stored in
7777
have names such as inode and directory entry. All tools in this layer
78-
begin with an 'i'.
78+
begin with an 'i'.
7979

8080
The 'ils' program lists some values of the metadata structures.
8181
By default, it will only list the unallocated ones. The 'istat'
@@ -87,15 +87,15 @@ contents of the data units allocated to the metadata structure
8787
which metadata structure has allocated a given content unit or
8888
file name.
8989

90-
Refer to the [ntfs wiki](http://wiki.sleuthkit.org/index.php?title=NTFS_Implementation_Notes)
90+
Refer to the [ntfs wiki](http://wiki.sleuthkit.org/index.php?title=NTFS_Implementation_Notes)
9191
for information on addressing metadata attributes in NTFS.
9292

9393
### Human Interface Layer (file):
9494
The human interface layer allows one to interact with files in a
9595
manner that is more convenient than directly with the metadata
9696
layer. In some operating systems there are separate structures for
9797
the metadata and human interface layers while others combine them.
98-
All tools in this layer begin with the letter 'f'.
98+
All tools in this layer begin with the letter 'f'.
9999

100100
The 'fls' program lists file and directory names. This tool will
101101
display the names of deleted files as well. The 'ffind' program will
@@ -125,8 +125,8 @@ Also included is the 'hfind' tool. The 'hfind' tool allows one to create
125125
an index of a hash database and perform quick lookups using a binary
126126
search algorithm. The 'hfind' tool can perform lookups on the NIST
127127
National Software Reference Library (NSRL) (www.nsrl.nist.gov) and
128-
files created from the 'md5' or 'md5sum' command. Refer to the
129-
[wiki/hfind](http://wiki.sleuthkit.org/index.php?title=Hfind) file for more details.
128+
files created from the 'md5' or 'md5sum' command. Refer to the
129+
[wiki/hfind](http://wiki.sleuthkit.org/index.php?title=Hfind) file for more details.
130130

131131
#### File Type Categories
132132
Different types of files typically have different internal structure.
@@ -146,6 +146,17 @@ and ignore known good files. Refer to the [wiki/sorter](http://wiki.sleuthkit.o
146146
file for more details.
147147

148148

149+
## TESTING
150+
Both unit and end-to-end tests are located in the [test](test/) directory. Small and legacy disk images are located in [test/data](test/data/). Some tests require disk images that are include in the [Github repository](https://github.com/sleuthkit/sleuthkit_test_data); large disk images are distributed as compressed (.E01) images using [git's extensions for large objects](https://git-lfs.com/). By default, this repo resides at [../sleuthkit_test_data](../sleuthkit_test_data]. However, it can be installed elsewhere by setting the environment variable `SLEUTHKIT_TEST_DATA_DIR`.
151+
152+
If the disk images are not present, tests requiring the disk images will generate a warning but not an error.
153+
154+
- Tests can be run by typing `make check`.
155+
156+
- Tests can be run on a new distribution by typing `make distcheck`.
157+
158+
159+
149160
## LICENSE
150161
There are a variety of licenses used in TSK based on where they
151162
were first developed. The licenses are located in the [licenses
@@ -160,14 +171,14 @@ Public License.
160171
- The modifications to 'mactime' from the original 'mactime' in TCT
161172
and 'mac-daddy' are released under the Common Public License.
162173

163-
The library uses utilities that were released under MIT and BSD 3-clause.
174+
The library uses utilities that were released under MIT and BSD 3-clause.
164175

165176

166177
## INSTALL
167178
For installation instructions, refer to the INSTALL.txt document.
168179

169180
## OTHER DOCS
170-
The [wiki](http://wiki.sleuthkit.org/index.php?title=Main_Page) contains documents that
181+
The [wiki](http://wiki.sleuthkit.org/index.php?title=Main_Page) contains documents that
171182
describe the provided tools in more detail. The Sleuth Kit Informer is a newsletter that contains
172183
new documentation and articles.
173184

@@ -182,4 +193,3 @@ announcements list.
182193
Brian Carrier
183194

184195
carrier at sleuthkit dot org
185-

test/README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,22 @@ Goals of unit testing
1111
4 - Run entirely within GitHub Actions.
1212
5 - Test with disk images that are publicly available.
1313

14-
1514
Disk Images
1615
-----------
16+
* The disk images now reside in a [single Github repository](https://github.com/sleuthkit/sleuthkit_test_data) using [git's extensions for large objects](https://git-lfs.com/).
17+
* By default, this repo resides at [../sleuthkit_test_data](../sleuthkit_test_data). However, it can be installed elsewhere by setting the environment variable `SLEUTHKIT_TEST_DATA_DIR`.
1718

18-
The unit test program is linked with fiwalk (without the fiwalk_main.cpp) so that we can just run fiwalk on disk images and do a full filesystem walk as part of our unit tests.
19+
Repo:
1920

20-
Disk Images
21+
Images larger than 10MB should be stored as a compressed data type (e.g. .E01)
22+
23+
24+
25+
Test Program
26+
------------
27+
The unit test program is linked with fiwalk (without the
28+
fiwalk_main.cpp) so that we can just run fiwalk on disk images and do
29+
a full filesystem walk as part of our unit tests.
2130

2231
XML should be prepared using fiwalk and then processing with xmlstarlet to remove the `<creator>` section, e.g.:
2332

test/data/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Small and legacy disk images are located here, but most should be installed in ../../../sleuthkit_test_data. This location can be changed by setting the environment variable `SLEUTHKIT_TEST_DATA_DIR`.

0 commit comments

Comments
 (0)