Skip to content

Commit 87437b3

Browse files
committed
Add tests for injecting large resources
Fixes: #12 Signed-off-by: Darshan Sen <[email protected]>
1 parent 90a8f03 commit 87437b3

File tree

16 files changed

+138
-104
lines changed

16 files changed

+138
-104
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ commands:
110110
- attach_workspace:
111111
at: .
112112

113-
- run: make check
113+
- run: make test
114114

115115
## JOBS ##
116116

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include vendor/vendorpull/targets.mk
33
include build/system.mk
44
include build/deps.mk
55

6-
all: vendor compile patch check
6+
all: vendor compile patch test
77

88
.PHONY: lief
99
lief: dist/lief
@@ -15,6 +15,6 @@ dist/lief:
1515
cd vendor/lief && python3 ./setup.py $(BUILD_OPTS) build_ext -b ../../$@ -j $(JOBS)
1616

1717

18-
.PHONY: check
19-
check:
20-
$(MAKE) -C examples/
18+
.PHONY: test
19+
test:
20+
./test.sh

README.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ $ ./postject.py --macho-segment-name __ELECTRON /Users/dsanders/electron/src/out
2929
### Testing
3030

3131
```sh
32-
$ make check
32+
$ make test
3333
```
3434

3535
## Design

examples/Makefile

Lines changed: 0 additions & 22 deletions
This file was deleted.

examples/test.S

Lines changed: 0 additions & 21 deletions
This file was deleted.

examples/test.c

Lines changed: 0 additions & 21 deletions
This file was deleted.

examples/test.cpp

Lines changed: 0 additions & 19 deletions
This file was deleted.

examples/test.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

test.list

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tests/inject_and_retrieve_data_1KB
2+
tests/inject_and_retrieve_data_1MB
3+
tests/inject_and_retrieve_data_1GB

test.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
3+
set -o errexit
4+
set -o nounset
5+
6+
while IFS= read -r test_directory
7+
do
8+
echo "---- Running $test_directory" 1>&2
9+
TEMPORARY_DIRECTORY="$(mktemp -d)"
10+
pwd="$PWD"
11+
cd "$test_directory"
12+
TEMPORARY_DIRECTORY="$TEMPORARY_DIRECTORY" ./test.sh \
13+
&& EXIT_CODE="$?" || EXIT_CODE="$?"
14+
cd "$pwd"
15+
rm -rf "$TEMPORARY_DIRECTORY"
16+
17+
if [ "$EXIT_CODE" = "0" ]
18+
then
19+
echo "\033[33;32m✓ PASS\x1b[0m $test_directory" 1>&2
20+
else
21+
echo "\033[33;31m× FAIL\x1b[0m $test_directory" 1>&2
22+
exit "$EXIT_CODE"
23+
fi
24+
done < test.list

0 commit comments

Comments
 (0)