Add Unix socket test

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2018-01-01 01:05:17 +01:00
parent e4e5b0d45e
commit 9e40d006eb
2 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -60,7 +60,7 @@ int main (int argc, char **argv) {
while (strstr(buffer, "--EOM--") == NULL)
{
printf("Message received: \"%s\"\n", buffer);
printf("%s", buffer);
// Receive message
size = recv(socketfd, buffer, BUF-1, 0);
@@ -70,7 +70,7 @@ int main (int argc, char **argv) {
buffer[size] = '\0';
}
printf("Message received: \"%s\"\n", buffer);
printf("%s", buffer);
close (socketfd);
return EXIT_SUCCESS;
+4 -2
View File
@@ -197,9 +197,11 @@ load 'libs/bats-support/load'
}
@test "Unix socket returning data" {
run bash -c './pihole-FTL help'
run bash -c './socket-test travis'
echo "output: ${lines[@]}"
[[ ${lines[0]} == "pihole-FTL - The Pi-hole FTL engine" ]]
[[ ${lines[0]} == "Socket created" ]]
[[ ${lines[1]} == "Connection established" ]]
[[ ${lines[2]} ~= "domains_being_blocked -1" ]]
}
@test "Final part of the tests: Killing pihole-FTL process" {