Skip to content
This repository has been archived by the owner on Jul 23, 2020. It is now read-only.

new test stuff #38

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
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
17 changes: 9 additions & 8 deletions tests/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
MAKEFLAGS = -j8
CFLAGS = -Wall -std=c99 -s -O2
LIBS = -ldnsapi -lws2_32 -lwininet -lshlwapi
CFLAGS = -Wall -std=c99 -s -O2
LIBS = -ldnsapi -lws2_32 -lwininet -lshlwapi
CAPSTONELIB = ../../capstone/capstone.lib

ifneq ($(OS),Windows_NT)
CC = i586-mingw32msvc-cc
CC = i686-w64-mingw32-gcc
else
CC = gcc
endif
Expand All @@ -13,14 +14,14 @@ TESTSEXE = $(TESTS:.c=.exe)

# please build all the object files using the main Makefile (in the parent
# directory)
CUCKOOOBJ := $(wildcard ../objects/*.o)
CUCKOOOBJ += $(wildcard ../objects/bson/*.o)
CUCKOOOBJ += $(wildcard ../objects/distorm3.2/*.o)
CUCKOOOBJ := $(wildcard ../../objects/*.o)
CUCKOOOBJ += $(wildcard ../../objects/bson/*.o)
CUCKOOOBJ += $(wildcard ../../capstone/*.o)

all: $(TESTSEXE)

%.exe: %.c $(CUCKOOOBJ) $(DISTORM3OBJ)
$(CC) $(CFLAGS) -I../distorm3.2-package/include -I.. -o $@ $^ $(LIBS)
%.exe: %.c $(CUCKOOOBJ) $(CAPSTONELIB)
$(CC) $(CFLAGS) -I../.. -I../../capstone -I../../capstone/arch/X86/ -o $@ $^ $(LIBS)

clean:
rm -f $(TESTSEXE)
30 changes: 30 additions & 0 deletions tests/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Directories:
======
* cuckooenvironment: The tests must be executed in a cuckoo virtual machine (Like a malware analysis). For example some checks about agent.py or checks about the human interaction.

* functionality: The tests for a funcionality, for example: testing the hook engine.

* others: Other kind of test, for example tests without a possible automation using the return.

Rules for tests:
======
* Add in the source header a description with:

** The purpose of the test.
** Why this test is necessary?

* Return value: A successful tests completion must be return 0. Otherwise return 1.

* The test must be return ALWAYS (exception for the "others category") to automate the testing process. This is useful using software like jenkins.

** For example one test make a big Sleep to test the "cuckoom sleep bypass":
*** Make a thread in the process. This thread checks if the Sleep is skipped or not.
*** If the Sleep is not skipped in 1 minute the thread can be terminate the process with return value 1.

* The test must be compile with Mingw.

* Use the Makefile If possible. If you need a special Makefile for a test: add a "mingw-make compatible" Makefile.

* Dont repeat an existent test. Maybe you can improve one.

* Use stderr to print errors.
64 changes: 0 additions & 64 deletions tests/apihooks.c

This file was deleted.

17 changes: 0 additions & 17 deletions tests/bind-port.c

This file was deleted.

18 changes: 0 additions & 18 deletions tests/blacklist.c

This file was deleted.

16 changes: 0 additions & 16 deletions tests/child-sleep.c

This file was deleted.

7 changes: 0 additions & 7 deletions tests/crash.c

This file was deleted.

24 changes: 0 additions & 24 deletions tests/create-file.c

This file was deleted.

150 changes: 0 additions & 150 deletions tests/delete-file.c

This file was deleted.

27 changes: 27 additions & 0 deletions tests/functionality/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
MAKEFLAGS = -j8
CFLAGS = -Wall -std=c99 -s -O2
LIBS = -ldnsapi -lws2_32 -lwininet -lshlwapi
CAPSTONELIB = ../../capstone/capstone.lib

ifneq ($(OS),Windows_NT)
CC = i686-w64-mingw32-gcc
else
CC = gcc
endif

TESTS = $(wildcard *.c)
TESTSEXE = $(TESTS:.c=.exe)

# please build all the object files using the main Makefile (in the parent
# directory)
CUCKOOOBJ := $(wildcard ../../objects/*.o)
CUCKOOOBJ += $(wildcard ../../objects/bson/*.o)
CUCKOOOBJ += $(wildcard ../../capstone/*.o)

all: $(TESTSEXE)

%.exe: %.c $(CUCKOOOBJ) $(CAPSTONELIB)
$(CC) $(CFLAGS) -I../.. -I../../capstone -I../../capstone/arch/X86/ -o $@ $^ $(LIBS)

clean:
rm -f $(TESTSEXE)
Loading