Use special socket file on Travis

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2018-01-01 01:02:54 +01:00
parent 900a3fa5cb
commit e4e5b0d45e
2 changed files with 10 additions and 1 deletions
+4 -1
View File
@@ -36,7 +36,10 @@ int main (int argc, char **argv) {
printf ("Socket created\n");
address.sun_family = AF_LOCAL;
strcpy(address.sun_path, UDS_FILE);
if(argc == 2 && strcmp(argv[1], "travis") == 0)
strcpy(address.sun_path,"pihole-FTL.sock");
else
strcpy(address.sun_path,"/var/run/pihole/FTL.sock");
ret = connect(socketfd, (struct sockaddr *) &address, sizeof (address));
if (ret != 0)
{
+6
View File
@@ -196,6 +196,12 @@ load 'libs/bats-support/load'
[[ ${lines[0]} == "pihole-FTL - The Pi-hole FTL engine" ]]
}
@test "Unix socket returning data" {
run bash -c './pihole-FTL help'
echo "output: ${lines[@]}"
[[ ${lines[0]} == "pihole-FTL - The Pi-hole FTL engine" ]]
}
@test "Final part of the tests: Killing pihole-FTL process" {
run bash -c 'echo ">kill" | nc -v 127.0.0.1 4711'
echo "output: ${lines[@]}"