-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Darshan Sen <raisinten@gmail.com>
- Loading branch information
Showing
13 changed files
with
121 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,7 +110,7 @@ commands: | |
- attach_workspace: | ||
at: . | ||
|
||
- run: make check | ||
- run: make test | ||
|
||
## JOBS ## | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/sh | ||
|
||
set -o errexit | ||
set -o nounset | ||
|
||
for test_directory in tests/* | ||
do | ||
if [ -d "$test_directory" ] | ||
then | ||
echo "---- Running $test_directory" 1>&2 | ||
TEMPORARY_DIRECTORY="$(mktemp -d)" | ||
pwd="$PWD" | ||
cd "$test_directory" | ||
TEMPORARY_DIRECTORY="$TEMPORARY_DIRECTORY" ./test.sh \ | ||
&& EXIT_CODE="$?" || EXIT_CODE="$?" | ||
cd "$pwd" | ||
rm -rf "$TEMPORARY_DIRECTORY" | ||
|
||
if [ "$EXIT_CODE" = "0" ] | ||
then | ||
echo "\033[33;32m✓ PASS\x1b[0m $test_directory" 1>&2 | ||
else | ||
echo "\033[33;31m× FAIL\x1b[0m $test_directory" 1>&2 | ||
exit "$EXIT_CODE" | ||
fi | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
#include "../../postject-api.h" | ||
|
||
int main() | ||
{ | ||
size_t size; | ||
const void *ptr = postject_find_resource("foobar", &size, NULL); | ||
|
||
if (ptr && size > 0) { | ||
char *str = (char *)malloc(size + 1); | ||
memset(str, 0, size + 1); | ||
strncpy(str, ptr, size); | ||
printf("%s\n", str); | ||
} else { | ||
printf("Hello world\n"); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/sh | ||
|
||
set -o errexit | ||
set -o nounset | ||
|
||
bin="$TEMPORARY_DIRECTORY/a.out" | ||
clang test.c -o "$bin" | ||
|
||
data="$(head -c 1000 /dev/urandom)" | ||
file="$TEMPORARY_DIRECTORY/data.txt" | ||
echo "$data" > "$file" | ||
|
||
../../postject.py --overwrite "$bin" "foobar" "$file" | ||
|
||
want="$data" | ||
have="$("$bin")" | ||
|
||
if [ "$have" != "$want" ] | ||
then | ||
echo "have: \""$have"\"" 1>&2 | ||
echo "want: \""$want"\"" 1>&2 | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
#include "../../postject-api.h" | ||
|
||
int main() | ||
{ | ||
size_t size; | ||
const void *ptr = postject_find_resource("foobar", &size, NULL); | ||
|
||
if (ptr && size > 0) { | ||
char *str = (char *)malloc(size + 1); | ||
memset(str, 0, size + 1); | ||
strncpy(str, ptr, size); | ||
printf("%s\n", str); | ||
} else { | ||
printf("Hello world\n"); | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/sh | ||
|
||
set -o errexit | ||
set -o nounset | ||
|
||
bin="$TEMPORARY_DIRECTORY/a.out" | ||
clang test.c -o "$bin" | ||
|
||
data="hello world @ $(date)" | ||
file="$TEMPORARY_DIRECTORY/data.txt" | ||
echo "$data" > "$file" | ||
|
||
../../postject.py --overwrite "$bin" "foobar" "$file" | ||
|
||
want="$data" | ||
have="$("$bin")" | ||
|
||
if [ "$have" != "$want" ] | ||
then | ||
echo "have: \""$have"\"" 1>&2 | ||
echo "want: \""$want"\"" 1>&2 | ||
exit 1 | ||
fi |