-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add configuration to check tmpfs magic
This adds a new test suite just for statfs to check that our wrapper returns the magic value for tmpfs when UNIFYFS_CLIENT_SUPER_MAGIC=0. A separate suite is required in order to change the environment under which the test runs.
- Loading branch information
Showing
5 changed files
with
139 additions
and
0 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,13 @@ | ||
#!/bin/bash | ||
# | ||
# Source sharness environment scripts to pick up test environment | ||
# and UnifyFS runtime settings. | ||
# | ||
. $(dirname $0)/sharness.d/00-test-env.sh | ||
. $(dirname $0)/sharness.d/01-unifyfs-settings.sh | ||
|
||
# disable statfs from returning UnifyFS! super magic value, | ||
# return tmpfs magic instead | ||
export UNIFYFS_CLIENT_SUPER_MAGIC=0 | ||
|
||
$JOB_RUN_COMMAND $UNIFYFS_BUILD_DIR/t/sys/statfs-gotcha.t |
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,13 @@ | ||
#!/bin/bash | ||
# | ||
# Source sharness environment scripts to pick up test environment | ||
# and UnifyFS runtime settings. | ||
# | ||
. $(dirname $0)/sharness.d/00-test-env.sh | ||
. $(dirname $0)/sharness.d/01-unifyfs-settings.sh | ||
|
||
# disable statfs from returning UnifyFS! super magic value, | ||
# return tmpfs magic instead | ||
export UNIFYFS_CLIENT_SUPER_MAGIC=0 | ||
|
||
$JOB_RUN_COMMAND $UNIFYFS_BUILD_DIR/t/sys/statfs-static.t |
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,63 @@ | ||
/* | ||
* Copyright (c) 2018, Lawrence Livermore National Security, LLC. | ||
* Produced at the Lawrence Livermore National Laboratory. | ||
* | ||
* Copyright 2018, UT-Battelle, LLC. | ||
* | ||
* LLNL-CODE-741539 | ||
* All rights reserved. | ||
* | ||
* This is the license for UnifyFS. | ||
* For details, see https://github.com/LLNL/UnifyFS. | ||
* Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. | ||
*/ | ||
|
||
#include <string.h> | ||
#include <mpi.h> | ||
#include <unifyfs.h> | ||
#include "t/lib/tap.h" | ||
#include "t/lib/testutil.h" | ||
|
||
#include "statfs_suite.h" | ||
|
||
/* The test suite for statfs wrappers found in client/src/unifyfs-sysio.c. | ||
* | ||
* This is specifically designed to test stafs when client super magic has | ||
* been disabled, so that statfs returns TMPFS_MAGIC. */ | ||
int main(int argc, char* argv[]) | ||
{ | ||
int rank_num; | ||
int rank; | ||
char* unifyfs_root; | ||
int rc; | ||
|
||
MPI_Init(&argc, &argv); | ||
MPI_Comm_size(MPI_COMM_WORLD, &rank_num); | ||
MPI_Comm_rank(MPI_COMM_WORLD, &rank); | ||
|
||
plan(NO_PLAN); | ||
|
||
unifyfs_root = testutil_get_mount_point(); | ||
|
||
/* Verify unifyfs_mount succeeds. */ | ||
rc = unifyfs_mount(unifyfs_root, rank, rank_num, 0); | ||
ok(rc == 0, "unifyfs_mount(%s) (rc=%d)", unifyfs_root, rc); | ||
|
||
/* If the mount fails, bailout, as there is no point in running the tests */ | ||
if (rc != 0) { | ||
BAIL_OUT("unifyfs_mount in statfs_suite failed"); | ||
} | ||
|
||
/* check that statfs returns TMPFS_MAGIC | ||
* when UNIFYFS_CLIENT_SUPER_MAGIC=0 */ | ||
statfs_test(unifyfs_root, 0); | ||
|
||
rc = unifyfs_unmount(); | ||
ok(rc == 0, "unifyfs_unmount(%s) (rc=%d)", unifyfs_root, rc); | ||
|
||
MPI_Finalize(); | ||
|
||
done_testing(); | ||
|
||
return 0; | ||
} |
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,26 @@ | ||
/* | ||
* Copyright (c) 2018, Lawrence Livermore National Security, LLC. | ||
* Produced at the Lawrence Livermore National Laboratory. | ||
* | ||
* Copyright 2018, UT-Battelle, LLC. | ||
* | ||
* LLNL-CODE-741539 | ||
* All rights reserved. | ||
* | ||
* This is the license for UnifyFS. | ||
* For details, see https://github.com/LLNL/UnifyFS. | ||
* Please read https://github.com/LLNL/UnifyFS/LICENSE for full license text. | ||
*/ | ||
|
||
|
||
/* This test checks that statfs returns the correct value when one | ||
* has set UNIFYFS_CLIENT_SUPER_MAGIC=0. It runs as a separate | ||
* test suite because it requires a different environmental | ||
* configuration than the other tests. */ | ||
#ifndef STATFS_SUITE_H | ||
#define STATFS_SUITE_H | ||
|
||
/* Tests for UNIFYFS_WRAP(statfs) */ | ||
int statfs_test(char* unifyfs_root, int expect_unifyfs_magic); | ||
|
||
#endif /* STATFS_SUITE_H */ |