forked from bws/xdd
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating how we file datapatterns work
Previously when the option -datapattern file/wholefile was used, XDD would open the file for every target and keep it open till the run was over. This is really unnecessary as the file only needs to be opened to read the datapattern in to set the datapattern in the target. Once that has happen, the file can immediately be closed. This is a good idea as there are limits to how many files can be opened in Linux (ulimit). XDD should not tie up the number of avialable open file descriptors just to set a datapattern over an entire XDD run. The code has been updated to open the file, set the target data_pattern buffer, and then immediately close the file. I have added a new functional test case test_xdd_file_datapattern.sh to test out that these this modification did not break the expected functionality of -datapattern file/wholefile. There was also just some general cleanup of the code that was done as part of this PR. Signed-off-by: Brian Atkinson <[email protected]>
- Loading branch information
1 parent
2468c98
commit f69d2e2
Showing
7 changed files
with
159 additions
and
43 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
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
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,56 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Acceptance test for XDD. | ||
# | ||
# Validate the funtionality of -datapattern file/wholefile option by creating a file, setting the datapattern | ||
# from that file and then verifying the contents match | ||
# | ||
# Description - terminates XDD after a given amount of seconds have passed | ||
# | ||
# Get absolute path to script | ||
SCRIPT=${BASH_SOURCE[0]} | ||
SCRIPTPATH=$(dirname "${SCRIPT}") | ||
|
||
# Source the test configuration environment | ||
source "${SCRIPTPATH}"/../test_config | ||
source "${SCRIPTPATH}"/../common.sh | ||
|
||
# Perform pre-test | ||
initialize_test | ||
test_dir="${XDDTEST_LOCAL_MOUNT}/${TESTNAME}" | ||
log_file="$(get_log_file)" | ||
|
||
input_file="${test_dir}/data1.dat" | ||
output_file="${test_dir}/data2.dat" | ||
|
||
# Create datapattern input file using dd | ||
dd if=/dev/urandom of="${input_file}" bs=4k count=2 | ||
|
||
# Write out file using xdd with -datapattern file | ||
"${XDDTEST_XDD_EXE}" -op write -reqsize 8 -numreqs 1 -datapattern file "${input_file}" -targets 1 "${output_file}" -qd 1 -passes 1 | ||
# Verify the contents of the file match | ||
if ! cmp "${input_file}" "${output_file}" | ||
then | ||
echo "Error when comparing files ${input_file} and ${output_file} with -datapattern file" > "${log_file}" | ||
cmp "${input_file}" "${output_file}" >> "${log_file}" | ||
rm "${input_file}" "${output_file}" | ||
finalize_test 1 "Issue with setting datapattern from file with -datapattern file. Contents don't match." | ||
fi | ||
|
||
rm "${output_file}" | ||
# Write out file using xdd with -datapattern wholefile | ||
# In this caes we will use two threads to write out the data in serial ordering as the | ||
# contents of the file will be distributed evenly between both threads. | ||
"${XDDTEST_XDD_EXE}" -op write -reqsize 4 -numreqs 2 -datapattern wholefile "${input_file}" -targets 1 "${output_file}" -serialordering -qd 2 -passes 1 | ||
# Verify the contents of the file match | ||
if ! cmp "${input_file}" "${output_file}" | ||
then | ||
echo "Error when comparing files ${input_file} and ${output_file} with -datapattern wholefile" > "${log_file}" | ||
cmp "${input_file}" "${output_file}" >> "${log_file}" | ||
rm "${input_file}" "${output_file}" | ||
finalize_test 1 "Issue with setting datapattern from file with -datapattern file. Contents don't match." | ||
fi | ||
rm "${input_file}" "${output_file}" | ||
|
||
# Test passed | ||
finalize_test 0 |