-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from glatard/master
Several changes
- Loading branch information
Showing
6 changed files
with
98 additions
and
13 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
jobs: | ||
include: | ||
- dist: bionic | ||
name: "Bionic" | ||
- dist: xenial | ||
name: "Xenial" | ||
language: C | ||
os: linux | ||
compiler: gcc | ||
|
||
before_install: | ||
- sudo apt-get update -qq | ||
- sudo apt-get install -qq bats | ||
|
||
install: | ||
- make | ||
|
||
script: | ||
- bats tests/tests.bats |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
all: passthrough.so | ||
passthrough.o: passthrough.cpp passthrough.h | ||
gcc -Wall -fPIC -c -ggdb passthrough.cpp | ||
gcc -Wall -fPIC -g -c -ggdb passthrough.cpp | ||
passthrough.so: passthrough.o | ||
gcc -shared -o passthrough.so passthrough.o -ldl -lpthread -ggdb | ||
gcc -shared -g -o passthrough.so passthrough.o -ldl -lpthread -ggdb -lstdc++ | ||
clean: | ||
rm passthrough.o passthrough.so |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
unset LD_PRELOAD # Clean up from previous tests | ||
\rm -Rf ${SOURCE} ${MOUNT} # Clean up from previous tests | ||
mkdir -p ${SOURCE} ${MOUNT} # Create source and mount (defined in tests.bats) | ||
echo ${SOURCE} > sources.txt | ||
echo a > a.txt # This file will be used in tests | ||
echo b > ${SOURCE}/file_in_source.txt # This file will be used in tests | ||
export LD_PRELOAD=${PWD}/passthrough.so |
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,49 @@ | ||
#!/usr/bin/env bats | ||
|
||
# Source and mount are | ||
# cleaned up in setup | ||
SOURCE="source" | ||
MOUNT="mount" | ||
|
||
@test "ls" { | ||
load setup | ||
a=$(ls ${MOUNT}) | ||
[[ $a == *"file_in_source.txt" ]] # passthrough init message is in a | ||
load unset | ||
} | ||
|
||
@test "mkdir" { | ||
load setup | ||
mkdir ${MOUNT}/dir | ||
load unset | ||
test -d ${SOURCE}/dir | ||
} | ||
|
||
@test "rm" { | ||
load setup | ||
rm ${MOUNT}/file_in_source.txt | ||
load unset | ||
[ ! -f ${SOURCE}/file_in_source.txt ] | ||
} | ||
|
||
@test "cp" { | ||
load setup | ||
cp a.txt ${MOUNT} | ||
load unset | ||
test -f ${SOURCE}/a.txt | ||
} | ||
|
||
@test "mv" { | ||
load setup | ||
mv a.txt ${MOUNT} | ||
load unset | ||
test -f ${SOURCE}/a.txt | ||
[ ! -f a.txt ] | ||
} | ||
|
||
@test "dd" { | ||
load setup | ||
dd if=/dev/random of=${MOUNT}/file count=3 | ||
load unset | ||
test -f ${SOURCE}/file | ||
} |
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 @@ | ||
unset LD_PRELOAD |