Merge pull request #8559 from poettering/integration-test-fixes

make integration tests pass again
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-03-23 19:21:25 +01:00 committed by GitHub
commit 1b25e0351a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 14 deletions

View file

@ -1,10 +1,9 @@
#!/bin/bash -e #!/bin/bash -e
for SCRIPT in ${@-*.cocci} ; do for SCRIPT in ${@-*.cocci} ; do
echo "--x-- Processing: spatch --sp-file $SCRIPT --dir $(pwd)/.. --x--" echo "--x-- Processing $SCRIPT --x--"
TMPFILE=`mktemp` TMPFILE=`mktemp`
spatch --sp-file $SCRIPT --dir $(pwd)/.. 2> "$TMPFILE" || cat "$TMPFILE" ( set -x ; spatch --sp-file $SCRIPT --dir $PWD/.. 2> "$TMPFILE" || cat "$TMPFILE" )
rm "$TMPFILE" rm "$TMPFILE"
echo "--x-- Processed: spatch --sp-file $SCRIPT --dir $(pwd)/.. --x--" echo -e "--x-- Processed $SCRIPT --x--\n"
echo ""
done done

View file

@ -254,7 +254,8 @@ int fd_is_network_ns(int fd) {
if (r <= 0) if (r <= 0)
return r; return r;
if (ioctl(fd, NS_GET_NSTYPE) < 0) r = ioctl(fd, NS_GET_NSTYPE);
if (r < 0)
return -errno; return -errno;
return r == CLONE_NEWNET; return r == CLONE_NEWNET;

View file

@ -821,7 +821,7 @@ static int fd_set_perms(Item *i, int fd, const struct stat *st) {
if (m == (st->st_mode & 07777)) if (m == (st->st_mode & 07777))
log_debug("\"%s\" has correct mode %o already.", path, st->st_mode); log_debug("\"%s\" has correct mode %o already.", path, st->st_mode);
else { else {
char procfs_path[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(int)]; char procfs_path[STRLEN("/proc/self/fd/") + DECIMAL_STR_MAX(int)];
log_debug("Changing \"%s\" to mode %o.", path, m); log_debug("Changing \"%s\" to mode %o.", path, m);
@ -920,7 +920,7 @@ static int parse_xattrs_from_arg(Item *i) {
} }
static int fd_set_xattrs(Item *i, int fd, const struct stat *st) { static int fd_set_xattrs(Item *i, int fd, const struct stat *st) {
char procfs_path[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(int)]; char procfs_path[STRLEN("/proc/self/fd/") + DECIMAL_STR_MAX(int)];
_cleanup_free_ char *path = NULL; _cleanup_free_ char *path = NULL;
char **name, **value; char **name, **value;
int r; int r;
@ -1024,7 +1024,7 @@ static int path_set_acl(const char *path, const char *pretty, acl_type_t type, a
static int fd_set_acls(Item *item, int fd, const struct stat *st) { static int fd_set_acls(Item *item, int fd, const struct stat *st) {
int r = 0; int r = 0;
#if HAVE_ACL #if HAVE_ACL
char procfs_path[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(int)]; char procfs_path[STRLEN("/proc/self/fd/") + DECIMAL_STR_MAX(int)];
_cleanup_free_ char *path = NULL; _cleanup_free_ char *path = NULL;
assert(item); assert(item);
@ -1186,7 +1186,7 @@ static int parse_attribute_from_arg(Item *item) {
} }
static int fd_set_attribute(Item *item, int fd, const struct stat *st) { static int fd_set_attribute(Item *item, int fd, const struct stat *st) {
char procfs_path[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(int)]; char procfs_path[STRLEN("/proc/self/fd/") + DECIMAL_STR_MAX(int)];
_cleanup_close_ int procfs_fd = -1; _cleanup_close_ int procfs_fd = -1;
_cleanup_free_ char *path = NULL; _cleanup_free_ char *path = NULL;
unsigned f; unsigned f;

View file

@ -10,6 +10,9 @@ TEST_NO_NSPAWN=1
# selinux-policy-targeted # selinux-policy-targeted
# selinux-policy-devel # selinux-policy-devel
# Check if selinux-policy-devel is installed, and if it isn't bail out early instead of failing
test -d /usr/share/selinux/devel || exit 0
. $TEST_BASE_DIR/test-functions . $TEST_BASE_DIR/test-functions
SETUP_SELINUX=yes SETUP_SELINUX=yes
KERNEL_APPEND="$KERNEL_APPEND selinux=1 security=selinux" KERNEL_APPEND="$KERNEL_APPEND selinux=1 security=selinux"

View file

@ -11,14 +11,16 @@ ninja -C "$BUILD_DIR"
declare -A results declare -A results
RESULT=0 COUNT=0
FAILURES=0 FAILURES=0
cd "$(dirname "$0")" cd "$(dirname "$0")"
for TEST in TEST-??-* ; do for TEST in TEST-??-* ; do
echo -e "\n--x-- Starting $TEST --x--" COUNT=$(($COUNT+1))
echo -e "\n--x-- Running $TEST --x--"
set +e set +e
make -C "$TEST" "BUILD_DIR=$BUILD_DIR" $args ( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" $args )
RESULT=$? RESULT=$?
set -e set -e
echo "--x-- Result of $TEST: $RESULT --x--" echo "--x-- Result of $TEST: $RESULT --x--"
@ -40,9 +42,9 @@ for TEST in ${!results[@]}; do
done | sort done | sort
if [ "$FAILURES" -eq 0 ] ; then if [ "$FAILURES" -eq 0 ] ; then
echo -e "\nALL PASSED" echo -e "\nALL $COUNT TESTS PASSED"
else else
echo -e "\nTOTAL FAILURES: $FAILURES" echo -e "\nTOTAL FAILURES: $FAILURES OF $COUNT"
fi fi
exit "$FAILURES" exit "$FAILURES"