-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Run IPC with use-filesystem-sockets active (#455)
* tests: Run IPC with use-filesystem-sockets active Provide an LD_PRELOAD library that simulates the presence of /etc/libqb/use-filesystem-sockets so that we can test that functionality without actually having the file on the system and affecting everything else running on the box. * use $() rather than `` * Cope with spaces in directory names * Docs: quote DOXYGEN2MAN in Makefile.am rather than configure.ac
- Loading branch information
1 parent
06e318f
commit 78df90b
Showing
6 changed files
with
114 additions
and
22 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
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,19 @@ | ||
#!/bin/sh | ||
# | ||
# Run the IPC tests under the stat wrapper, | ||
# this simulates /etc/libqb/use-filesystem-sockets existing | ||
# so we can test both options without breaking other things | ||
# that might be running on this system | ||
# | ||
if [ "$(uname -s)" = "Linux" ] | ||
then | ||
if [ -f "$(pwd)/.libs/libstat_wrapper.so" ] | ||
then | ||
export "LD_PRELOAD=$(pwd)/.libs/libstat_wrapper.so" | ||
else | ||
export "LD_PRELOAD=$(pwd)/libstat_wrapper.so" | ||
fi | ||
./ipc.test | ||
else | ||
exit 0 | ||
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,58 @@ | ||
/* | ||
* Simulate FORCESOCKETSFILE existing for the IPC tests | ||
*/ | ||
#define _GNU_SOURCE | ||
#include <stdio.h> | ||
#include <dlfcn.h> | ||
#include <string.h> | ||
#include <sys/stat.h> | ||
#include "../include/config.h" | ||
#if defined(QB_LINUX) || defined(QB_CYGWIN) | ||
#include <gnu/lib-names.h> | ||
#endif | ||
|
||
// __xstat for earlier libc | ||
int __xstat(int __ver, const char *__filename, struct stat *__stat_buf) | ||
{ | ||
#if defined(QB_LINUX) || defined(QB_CYGWIN) | ||
static int opened = 0; | ||
static int (*real_xstat)(int __ver, const char *__filename, void *__stat_buf); | ||
|
||
if (!opened) { | ||
real_xstat = dlsym(RTLD_NEXT, "__xstat"); | ||
opened = 1; | ||
} | ||
|
||
if (strcmp(__filename, FORCESOCKETSFILE) == 0) { | ||
fprintf(stderr, "__xstat called for %s\n", __filename); | ||
return 0; /* it exists! */ | ||
} | ||
|
||
return real_xstat(__ver, __filename, __stat_buf); | ||
#else | ||
return -1; /* Error in the unlikely event we get called on *BSD* */ | ||
#endif | ||
} | ||
|
||
// stat for F35 and later | ||
int stat(const char *__filename, struct stat *__stat_buf) | ||
{ | ||
#if defined(QB_LINUX) || defined(QB_CYGWIN) | ||
static int opened = 0; | ||
static int (*real_stat)(const char *__filename, void *__stat_buf); | ||
|
||
if (!opened) { | ||
real_stat = dlsym(RTLD_NEXT, "stat"); | ||
opened = 1; | ||
} | ||
|
||
if (strcmp(__filename, FORCESOCKETSFILE) == 0) { | ||
fprintf(stderr, "stat called for %s\n", __filename); | ||
return 0; /* it exists! */ | ||
} | ||
|
||
return real_stat(__filename, __stat_buf); | ||
#else | ||
return -1; /* Error in the unlikely event we get called on *BSD* */ | ||
#endif | ||
} |
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