Added framework for smoke tests and few basic tests.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
31
test/smoke_test/basic/01
Executable file
31
test/smoke_test/basic/01
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2019 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
# The line below specified that line under it should be used as the test's short description when launching test via run_tests script.
|
||||
# The text should not be longer than 80 chars - if it is, the script will strip addititonal characters
|
||||
# DESCRIPTION Verify Open CAS CLI using --version
|
||||
|
||||
# The line below says that this test should be included in BVT - it will be launched, when we use "./run_tests -b"
|
||||
# USE_IN_BVT
|
||||
# USE_IN_NIGHTLY
|
||||
|
||||
# Standard beginning for every test - get the main tests directory and
|
||||
# link the cas_lib file for CAS API, then use "start_test $*" to pass params
|
||||
# and do other necessary checks and setup
|
||||
TESTS_DIR="$(dirname $0)/../"
|
||||
. $TESTS_DIR/cas_lib
|
||||
start_test $*
|
||||
|
||||
# This is where the real test starts
|
||||
|
||||
# Test if the APP exists, if it has option "--version" and if it returns a correct status
|
||||
run_cmd "$CAS --version"
|
||||
|
||||
# Always return 0 at the end of the test - if at any point something has failed
|
||||
# in the API functions, test will end and return a proper result.
|
||||
# If you need to check other things during the test and end the test earlier, you
|
||||
# should end the test using "end_test $retval" function
|
||||
end_test 0
|
46
test/smoke_test/basic/02
Executable file
46
test/smoke_test/basic/02
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2019 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
# The line below specified that line under it should be used as the test's short description when launching test via run_tests script.
|
||||
# The text should not be longer than 80 chars - if it is, the script will strip addititonal characters
|
||||
# DESCRIPTION Adding valid & invalid core devices to caches
|
||||
|
||||
# The line below says that this test should be included in BVT - it will be launched, when we use "./run_tests -b"
|
||||
# USE_IN_BVT
|
||||
# USE_IN_NIGHTLY
|
||||
|
||||
# Standard beginning for every test - get the main tests directory and
|
||||
# link the cas_lib file for CAS API, then use "start_test $*" to pass params
|
||||
# and do other necessary checks and setup
|
||||
TESTS_DIR="$(dirname $0)/../"
|
||||
. $TESTS_DIR/cas_lib
|
||||
start_test $*
|
||||
|
||||
# This is where the real test starts
|
||||
|
||||
# Use CACHE_DEVICE provided by configuration file and remove partitions from this device
|
||||
TARGET_DEVICE_OPTION="$CACHE_DEVICE" remove_partitions
|
||||
|
||||
# Create one primary partition (ID=1) of size 2000M on CACHE_DEVICE
|
||||
TARGET_DEVICE_OPTION="$CACHE_DEVICE" PARTITION_SIZE_OPTION="2000M" PARTITION_IDS_OPTION="1" make_primary_partitions
|
||||
|
||||
# Start cache with ID=1 on device ${CACHE_DEVICE}1 (/dev/sda1, for instance)
|
||||
CACHE_ID_OPTION="1" CACHE_DEVICE_OPTION="${CACHE_DEVICE}1" start_cache
|
||||
|
||||
# Use the same device but a different ID - negative test
|
||||
CACHE_ID_OPTION="2" CACHE_DEVICE_OPTION="${CACHE_DEVICE}1" NEGATIVE_TEST_OPTION="1" start_cache
|
||||
|
||||
# Use the same ID but a different device - another negative test
|
||||
CACHE_ID_OPTION="1" CACHE_DEVICE_OPTION="${CACHE_DEVICE}2" NEGATIVE_TEST_OPTION="1" start_cache
|
||||
|
||||
# Clear up after test
|
||||
CACHE_ID_OPTION="1" stop_cache
|
||||
|
||||
# Always return 0 at the end of the test - if at any point something has failed
|
||||
# in the API functions, test will end and return a proper result.
|
||||
# If you need to check other things during the test and end the test earlier, you
|
||||
# should end the test using "end_test $retval" function
|
||||
end_test 0
|
69
test/smoke_test/basic/03
Executable file
69
test/smoke_test/basic/03
Executable file
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2019 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
# The line below specified that line under it should be used as the test's short description when launching test via run_tests script.
|
||||
# The text should not be longer than 80 chars - if it is, the script will strip addititonal characters
|
||||
# DESCRIPTION Create two caches and try to insert invalid cores to them
|
||||
|
||||
# The line below says that this test should be included in BVT - it will be launched, when we use "./run_tests -b"
|
||||
|
||||
# USE_IN_NIGHTLY
|
||||
|
||||
# Standard beginning for every test - get the main tests directory and
|
||||
# link the cas_lib file for CAS API, then use "start_test $*" to pass params
|
||||
# and do other necessary checks and setup
|
||||
TESTS_DIR="$(dirname $0)/../"
|
||||
. $TESTS_DIR/cas_lib
|
||||
start_test $*
|
||||
|
||||
# This is where the real test starts
|
||||
|
||||
# Use CACHE_DEVICE and CORE_DEVICE provided by configuration file and remove partitions from those devices
|
||||
TARGET_DEVICE_OPTION="$CACHE_DEVICE" remove_partitions
|
||||
TARGET_DEVICE_OPTION="$CORE_DEVICE" remove_partitions
|
||||
|
||||
# Create 2 primary partitions on CACHE_DEVICE, each of 2000M size
|
||||
TARGET_DEVICE_OPTION="$CACHE_DEVICE" PARTITION_SIZE_OPTION="2000M" PARTITION_IDS_OPTION="1 2" make_primary_partitions
|
||||
# Create 2 primary partitions on CORE_DEVICE, each of 4000M size
|
||||
TARGET_DEVICE_OPTION="$CORE_DEVICE" PARTITION_SIZE_OPTION="4000M" PARTITION_IDS_OPTION="1 2" make_primary_partitions
|
||||
|
||||
# Start cache on CACHE_DEVICE1 (/dev/sdd1, for example) with ID=1 and add a core device using CORE_DEVICE1 (/dev/sde1, for example)
|
||||
CACHE_ID_OPTION="1" CACHE_DEVICE_OPTION="${CACHE_DEVICE}1" start_cache
|
||||
CACHE_ID_OPTION="1" CORE_DEVICE_OPTION="${CORE_DEVICE}1" add_core
|
||||
|
||||
# Start cache on CACHE_DEVICE2 (/dev/sdd2, for example) with ID=2 and add a core device using CORE_DEVICE1 (/dev/sde2, for example)
|
||||
CACHE_ID_OPTION="2" CACHE_DEVICE_OPTION="${CACHE_DEVICE}2" start_cache
|
||||
CACHE_ID_OPTION="2" CORE_DEVICE_OPTION="${CORE_DEVICE}2" add_core
|
||||
|
||||
# Try to add already taken CORE device and a non-existing core to cache 1
|
||||
NEGATIVE_TEST_OPTION="1" CACHE_ID_OPTION="1" CORE_DEVICE_OPTION="${CORE_DEVICE}1" add_core
|
||||
NEGATIVE_TEST_OPTION="1" CACHE_ID_OPTION="1" CORE_DEVICE_OPTION="${CORE_DEVICE}2" add_core
|
||||
NEGATIVE_TEST_OPTION="1" CACHE_ID_OPTION="1" CORE_DEVICE_OPTION="${CORE_DEVICE}3" add_core
|
||||
|
||||
# Try to add already taken CORE device and a non-existing core to cache 2
|
||||
NEGATIVE_TEST_OPTION="1" CACHE_ID_OPTION="2" CORE_DEVICE_OPTION="${CORE_DEVICE}1" add_core
|
||||
NEGATIVE_TEST_OPTION="1" CACHE_ID_OPTION="2" CORE_DEVICE_OPTION="${CORE_DEVICE}2" add_core
|
||||
NEGATIVE_TEST_OPTION="1" CACHE_ID_OPTION="2" CORE_DEVICE_OPTION="${CORE_DEVICE}3" add_core
|
||||
|
||||
# Remove the core device from cache
|
||||
CACHE_ID_OPTION="1" CORE_ID_OPTION="1" remove_core
|
||||
# Try to do it again - this should fail
|
||||
NEGATIVE_TEST_OPTION="1" CACHE_ID_OPTION="1" CORE_ID_OPTION="1" remove_core
|
||||
# Clean up after the test
|
||||
CACHE_ID_OPTION="1" stop_cache
|
||||
|
||||
# Remove the core device from cache
|
||||
CACHE_ID_OPTION="2" CORE_ID_OPTION="1" remove_core
|
||||
# Try to do it again - this should fail
|
||||
NEGATIVE_TEST_OPTION="1" CACHE_ID_OPTION="2" CORE_ID_OPTION="1" remove_core
|
||||
# Clean up after the test
|
||||
CACHE_ID_OPTION="2" stop_cache
|
||||
|
||||
# Always return 0 at the end of the test - if at any point something has failed
|
||||
# in the API functions, test will end and return a proper result.
|
||||
# If you need to check other things during the test and end the test earlier, you
|
||||
# should end the test using "end_test $retval" function
|
||||
end_test 0
|
86
test/smoke_test/basic/04
Executable file
86
test/smoke_test/basic/04
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2019 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
# The line below specified that line under it should be used as the test's short description when launching test via run_tests script.
|
||||
# The text should not be longer than 80 chars - if it is, the script will strip addititonal characters
|
||||
# DESCRIPTION Test files on core devices with different filesystems after stopping cache
|
||||
|
||||
# USE_IN_BVT
|
||||
# USE_IN_NIGHTLY
|
||||
|
||||
# Standard beginning for every test - get the main tests directory and
|
||||
# link the cas_lib file for CAS API, then use "start_test $*" to pass params
|
||||
# and do other necessary checks and setup
|
||||
TESTS_DIR="$(dirname $0)/../"
|
||||
. $TESTS_DIR/cas_lib
|
||||
start_test $*
|
||||
|
||||
# This is where the real test starts
|
||||
|
||||
# Use CACHE_DEVICE and CORE_DEVICE provided by configuration file and remove partitions from those devices
|
||||
TARGET_DEVICE_OPTION="$CACHE_DEVICE" remove_partitions
|
||||
TARGET_DEVICE_OPTION="$CORE_DEVICE" remove_partitions
|
||||
|
||||
# Create 3 primary partitions on CACHE_DEVICE, each of 2000M size
|
||||
TARGET_DEVICE_OPTION="$CACHE_DEVICE" PARTITION_SIZE_OPTION="2000M" PARTITION_IDS_OPTION="1 2 3" make_primary_partitions
|
||||
# Create 3 primary partitions on CORE_DEVICE, each of 4000M size
|
||||
TARGET_DEVICE_OPTION="$CORE_DEVICE" PARTITION_SIZE_OPTION="4000M" PARTITION_IDS_OPTION="1 2 3" make_primary_partitions
|
||||
run_cmd dd if=/dev/zero of="${CORE_DEVICE}1" bs=1M count=1 oflag=direct
|
||||
run_cmd dd if=/dev/zero of="${CORE_DEVICE}2" bs=1M count=1 oflag=direct
|
||||
run_cmd dd if=/dev/zero of="${CORE_DEVICE}3" bs=1M count=1 oflag=direct
|
||||
|
||||
# Start cache on CACHE_DEVICE1 (/dev/sdd1, for example) with ID=1 and add a core device using CORE_DEVICE1 (/dev/sde1, for example)
|
||||
CACHE_ID_OPTION="1" CACHE_DEVICE_OPTION="${CACHE_DEVICE}1" start_cache
|
||||
CACHE_ID_OPTION="1" CORE_DEVICE_OPTION="${CORE_DEVICE}1" add_core
|
||||
|
||||
# Start cache on CACHE_DEVICE2 (/dev/sdd2, for example) with ID=2 and add a core device using CORE_DEVICE2 (/dev/sde2, for example)
|
||||
CACHE_ID_OPTION="2" CACHE_DEVICE_OPTION="${CACHE_DEVICE}2" start_cache
|
||||
CACHE_ID_OPTION="2" CORE_DEVICE_OPTION="${CORE_DEVICE}2" add_core
|
||||
|
||||
# Start cache on CACHE_DEVICE3 (/dev/sdd3, for example) with ID=3 and add a core device using CORE_DEVICE3 (/dev/sde3, for example)
|
||||
CACHE_ID_OPTION="3" CACHE_DEVICE_OPTION="${CACHE_DEVICE}3" start_cache
|
||||
CACHE_ID_OPTION="3" CORE_DEVICE_OPTION="${CORE_DEVICE}3" add_core
|
||||
|
||||
# Create filesystems on cached devices - we do this using run_cmd because it is not in the API (and probably won't be).
|
||||
# The test framework will accept invoking the commands directly (e.g. "mkfs.ext3 [...]" without the "run_cmd"), but the
|
||||
# results have to be checked manually by the test.
|
||||
TARGET_DEVICE_OPTION="${DEVICE_NAME}1-1" FILESYSTEM_TYPE="ext3" make_filesystem
|
||||
TARGET_DEVICE_OPTION="${DEVICE_NAME}2-1" FILESYSTEM_TYPE="ext4" make_filesystem
|
||||
TARGET_DEVICE_OPTION="${DEVICE_NAME}3-1" FILESYSTEM_TYPE="xfs" make_filesystem
|
||||
|
||||
# Specify a temporary file used for md5sums - note that it resides in $TMP_DIR, which is a special directory defined in cas_config.
|
||||
# Everytime we use temporary files, they should be placed in that special directory. Its contents are cleared after every test.
|
||||
MD5_FILE="$TMP_DIR/cas_md5_sum_"
|
||||
|
||||
# Mount the filesystems, then create the example files and save their MD5 sums locally in the temporary place
|
||||
# Note the usage of ${MOUNTPOINT} - mount_cache always mounts using following formula: ${MOUNTPOINT}-${CACHE_ID_OPTION}-${CORE_ID_OPTION}.
|
||||
for ID in 1 2 3 ; do
|
||||
CACHE_ID_OPTION="$ID" CORE_ID_OPTION="1" mount_cache
|
||||
run_cmd "dd if=/dev/urandom of=${MOUNTPOINT}-${ID}-1/test bs=50M count=1"
|
||||
run_cmd "md5sum ${MOUNTPOINT}-${ID}-1/test > ${MD5_FILE}${ID}"
|
||||
done
|
||||
|
||||
# Umount & stop the caches, then mount the core devices
|
||||
# Note the usage of ${MOUNTPOINT} - mount_cache always mounts using following formula: ${MOUNTPOINT}-${CACHE_ID_OPTION}-${CORE_ID_OPTION}.
|
||||
for ID in 1 2 3 ; do
|
||||
run_cmd "umount ${MOUNTPOINT}-${ID}-1"
|
||||
CACHE_ID_OPTION="$ID" stop_cache
|
||||
run_cmd "mount ${CORE_DEVICE}${ID} ${MOUNTPOINT}-${ID}-1"
|
||||
done
|
||||
|
||||
# Now check for files' presence and umount core devices
|
||||
# Note the usage of ${MOUNTPOINT} - mount_cache always mounts using following formula: ${MOUNTPOINT}-${CACHE_ID_OPTION}-${CORE_ID_OPTION}.
|
||||
for ID in 1 2 3 ; do
|
||||
run_cmd "test -f ${MOUNTPOINT}-${ID}-1/test"
|
||||
run_cmd "md5sum -c ${MD5_FILE}${ID}"
|
||||
run_cmd "umount ${MOUNTPOINT}-${ID}-1"
|
||||
done
|
||||
|
||||
# Always return 0 at the end of the test - if at any point something has failed
|
||||
# in the API functions, test will end and return a proper result.
|
||||
# If you need to check other things during the test and end the test earlier, you
|
||||
# should end the test using "end_test $retval" function
|
||||
end_test 0
|
50
test/smoke_test/basic/05
Executable file
50
test/smoke_test/basic/05
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2019 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
# The line below specified that line under it should be used as the test's short description when launching test via run_tests script.
|
||||
# The text should not be longer than 80 chars - if it is, the script will strip addititonal characters
|
||||
# DESCRIPTION Setup CAS with valid and invalid IDs
|
||||
|
||||
# USE_IN_NIGHTLY
|
||||
|
||||
# Standard beginning for every test - get the main tests directory and
|
||||
# link the cas_lib file for CAS API, then use "start_test $*" to pass params
|
||||
# and do other necessary checks and setup
|
||||
TESTS_DIR="$(dirname $0)/../"
|
||||
. $TESTS_DIR/cas_lib
|
||||
start_test $*
|
||||
|
||||
# This is where the real test starts
|
||||
|
||||
# Specify "arrays" of IDs used in test
|
||||
POSITIVE_IDS="1 9238 16384"
|
||||
NEGATIVE_IDS="-1 abc 16385"
|
||||
|
||||
# Use CACHE_DEVICE provided by configuration file and remove partitions from this device
|
||||
TARGET_DEVICE_OPTION="$CACHE_DEVICE" remove_partitions
|
||||
# Create 1 primary partition on CACHE_DEVICE of 2000M size
|
||||
TARGET_DEVICE_OPTION="$CACHE_DEVICE" PARTITION_SIZE_OPTION="2000M" PARTITION_IDS_OPTION="1" make_primary_partitions
|
||||
|
||||
# Try to start positive caches in loop and later stop them - if any of those operations fails, it
|
||||
# means the cache ID is invalid
|
||||
for ID in $POSITIVE_IDS ; do
|
||||
CACHE_ID_OPTION="$ID" CACHE_DEVICE_OPTION="${CACHE_DEVICE}1" start_cache
|
||||
CACHE_ID_OPTION="$ID" stop_cache
|
||||
done
|
||||
|
||||
# Try to start negative caches in loop - if any of those operations succeeds, it
|
||||
# means the cache ID is valid (and it shouldn't be). Note that we can't provide an empty
|
||||
# ID, because the framework will treat it as an undefined option and will fail the test
|
||||
# automatically.
|
||||
for ID in $NEGATIVE_IDS ; do
|
||||
NEGATIVE_TEST_OPTION="1" CACHE_ID_OPTION="$ID" CACHE_DEVICE_OPTION="${CACHE_DEVICE}1" start_cache
|
||||
done
|
||||
|
||||
# Always return 0 at the end of the test - if at any point something has failed
|
||||
# in the API functions, test will end and return a proper result.
|
||||
# If you need to check other things during the test and end the test earlier, you
|
||||
# should end the test using "end_test $retval" function
|
||||
end_test 0
|
68
test/smoke_test/basic/06
Executable file
68
test/smoke_test/basic/06
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2019 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
#DESCRIPTION --set-param option fuzzing.
|
||||
|
||||
# This tests checks whether CLI accepts correct data and rejects incorrect
|
||||
# data for "--flush-parameters" option. It tries to invoke CLI using different
|
||||
# combinations of required options and checks the return code.
|
||||
|
||||
TESTS_DIR="$(dirname $0)/../"
|
||||
. $TESTS_DIR/cas_lib
|
||||
start_test $*
|
||||
|
||||
# remove all partitions from cache and core
|
||||
TARGET_DEVICE_OPTION="$CACHE_DEVICE" remove_partitions
|
||||
TARGET_DEVICE_OPTION="$CORE_DEVICE" remove_partitions
|
||||
|
||||
# Create 1 primary partition on CACHE_DEVICE of 2000M size
|
||||
TARGET_DEVICE_OPTION="$CACHE_DEVICE" PARTITION_SIZE_OPTION="2000M" PARTITION_IDS_OPTION="1" make_primary_partitions
|
||||
|
||||
# create cache in WT mode and try to change flush-parameters
|
||||
CACHE_MODE_OPTION="wt" CACHE_ID_OPTION="1" CACHE_DEVICE_OPTION="${CACHE_DEVICE}1" CACHE_FORCE_OPTION="1" start_cache
|
||||
|
||||
# changing flush parameters should be prohibited while core is added to cache
|
||||
CACHE_ID_OPTION="1" CORE_DEVICE_OPTION="$CORE_DEVICE" add_core
|
||||
CACHE_ID_OPTION="1" CLEAN_POL_NS_OPTION="cleaning-alru" WAKE_UP_OPTION="100" STALE_TIME_OPTION="50" FLUSH_BUFFERS_OPTION="100" ACTIVITY_THRESH_OPTION="5" NEGATIVE_TEST_OPTION="1" set_flush_params
|
||||
|
||||
# remove core
|
||||
sleep 1
|
||||
CACHE_ID_OPTION="1" CORE_ID_OPTION="1" remove_core
|
||||
|
||||
printf "\n============Running negative tests============\n"
|
||||
|
||||
# bunch of negative test checking whether CAS accepts not valid options for flush-parameters command
|
||||
# test various policy names
|
||||
CACHE_ID_OPTION="1" CLEAN_POL_NS_OPTION="cleaning-dummy" WAKE_UP_OPTION="100" STALE_TIME_OPTION="50" FLUSH_BUFFERS_OPTION="100" ACTIVITY_THRESH_OPTION="5" NEGATIVE_TEST_OPTION="1" set_flush_params
|
||||
CACHE_ID_OPTION="1" CLEAN_POL_NS_OPTION="cleaning-noop" WAKE_UP_OPTION="100" STALE_TIME_OPTION="50" FLUSH_BUFFERS_OPTION="100" ACTIVITY_THRESH_OPTION="5" NEGATIVE_TEST_OPTION="1" set_flush_params
|
||||
|
||||
# test for negative numeric options
|
||||
CACHE_ID_OPTION="1" CLEAN_POL_NS_OPTION="cleaning-alru" WAKE_UP_OPTION="-1" STALE_TIME_OPTION="50" FLUSH_BUFFERS_OPTION="100" ACTIVITY_THRESH_OPTION="5" NEGATIVE_TEST_OPTION="1" set_flush_params
|
||||
CACHE_ID_OPTION="1" CLEAN_POL_NS_OPTION="cleaning-alru" WAKE_UP_OPTION="100" STALE_TIME_OPTION="-1" FLUSH_BUFFERS_OPTION="100" ACTIVITY_THRESH_OPTION="5" NEGATIVE_TEST_OPTION="1" set_flush_params
|
||||
CACHE_ID_OPTION="1" CLEAN_POL_NS_OPTION="cleaning-alru" WAKE_UP_OPTION="100" STALE_TIME_OPTION="50" FLUSH_BUFFERS_OPTION="-1" ACTIVITY_THRESH_OPTION="5" NEGATIVE_TEST_OPTION="1" set_flush_params
|
||||
CACHE_ID_OPTION="1" CLEAN_POL_NS_OPTION="cleaning-alru" WAKE_UP_OPTION="100" STALE_TIME_OPTION="50" FLUSH_BUFFERS_OPTION="100" ACTIVITY_THRESH_OPTION="-1" NEGATIVE_TEST_OPTION="1" set_flush_params
|
||||
|
||||
# test for 0 wake_up_time and 0 flush buffers
|
||||
CACHE_ID_OPTION="1" CLEAN_POL_NS_OPTION="cleaning-alru" WAKE_UP_OPTION="0" STALE_TIME_OPTION="50" FLUSH_BUFFERS_OPTION="100" ACTIVITY_THRESH_OPTION="5" NEGATIVE_TEST_OPTION="1" set_flush_params
|
||||
CACHE_ID_OPTION="1" CLEAN_POL_NS_OPTION="cleaning-alru" WAKE_UP_OPTION="100" STALE_TIME_OPTION="50" FLUSH_BUFFERS_OPTION="0" ACTIVITY_THRESH_OPTION="5" NEGATIVE_TEST_OPTION="1" set_flush_params
|
||||
|
||||
printf "\n============Running positive tests============\n"
|
||||
|
||||
# positive test
|
||||
# test various policy names
|
||||
CACHE_ID_OPTION="1" CLEAN_POL_OPTION="nop" set_cleaning_policy
|
||||
CACHE_ID_OPTION="1" CLEAN_POL_OPTION="acp" set_cleaning_policy
|
||||
CACHE_ID_OPTION="1" CLEAN_POL_OPTION="alru" set_cleaning_policy
|
||||
|
||||
CACHE_ID_OPTION="1" CLEAN_POL_NS_OPTION="cleaning-alru" WAKE_UP_OPTION="100" STALE_TIME_OPTION="1" FLUSH_BUFFERS_OPTION="100" ACTIVITY_THRESH_OPTION="500" set_flush_params
|
||||
CACHE_ID_OPTION="1" CLEAN_POL_NS_OPTION="cleaning-alru" WAKE_UP_OPTION="100" STALE_TIME_OPTION="50" FLUSH_BUFFERS_OPTION="100" ACTIVITY_THRESH_OPTION="500" set_flush_params
|
||||
|
||||
CACHE_ID_OPTION="1" CLEAN_POL_NS_OPTION="cleaning-alru" WAKE_UP_OPTION="100" STALE_TIME_OPTION="50" FLUSH_BUFFERS_OPTION="100" ACTIVITY_THRESH_OPTION="500" set_flush_params
|
||||
|
||||
# stop cache now
|
||||
CACHE_ID_OPTION="1" stop_cache
|
||||
|
||||
end_test 0
|
42
test/smoke_test/basic/07
Executable file
42
test/smoke_test/basic/07
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2019 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
# The line below specified that line under it should be used as the test's short description when launching test via run_tests script.
|
||||
# The text should not be longer than 80 chars - if it is, the script will strip addititonal characters
|
||||
# DESCRIPTION Validate spelling of help in CLI
|
||||
|
||||
# USE_IN_NIGHTLY
|
||||
|
||||
# Standard beginning for every test - get the main tests directory and
|
||||
# link the cas_lib file for CAS API, then use "start_test $*" to pass params
|
||||
# and do other necessary checks and setup
|
||||
TESTS_DIR="$(dirname $0)/../"
|
||||
. $TESTS_DIR/cas_lib
|
||||
start_test $*
|
||||
|
||||
FAIL=0
|
||||
|
||||
PERSONAL_DICTIONARY=`pwd`/cas_ex.en.pws
|
||||
|
||||
run_aspell() {
|
||||
run_cmd "$1 2>&1 | aspell list --lang=en_US --add-extra-dicts=$PERSONAL_DICTIONARY"
|
||||
for N in $OUTPUT ; do
|
||||
if [ -n $N ] ; then
|
||||
FAIL=1
|
||||
error "Misspelled word: $N"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
run_aspell "$CAS -H"
|
||||
|
||||
COMMANDS=`$CAS -H | awk '/Available commands:/{ cmd=1;next } /For detailed help/ { cmd=0 } cmd { print $0 }' | grep -o '\-\-\S*'`
|
||||
|
||||
for CMD in $COMMANDS ; do
|
||||
run_aspell "$CAS $CMD -H"
|
||||
done
|
||||
|
||||
end_test $FAIL
|
169
test/smoke_test/basic/08
Executable file
169
test/smoke_test/basic/08
Executable file
@@ -0,0 +1,169 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2019 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
# DESCRIPTION Verify if write mode: read only, works as expected and cache only reads and do not cache writes
|
||||
|
||||
TESTS_DIR="$(dirname $0)/../"
|
||||
. $TESTS_DIR/cas_lib
|
||||
start_test $*
|
||||
|
||||
CACHE_DEVICE_SIZE=1G
|
||||
CORE_DEVICE_SIZE=2G
|
||||
|
||||
BLOCK_SIZE=4096
|
||||
COUNT=100
|
||||
|
||||
IOSTAT_BLOCK_SIZE=1024
|
||||
if [ $POSIXLY_CORRECT ]; then
|
||||
IOSTAT_BLOCK_SIZE=512
|
||||
fi
|
||||
|
||||
L_TEST_STATUS=0
|
||||
|
||||
# Use CACHE_DEVICE and CORE_DEVICE provided by configuration file and remove partitions from those devices
|
||||
TARGET_DEVICE_OPTION="$CACHE_DEVICE" remove_partitions
|
||||
TARGET_DEVICE_OPTION="$CORE_DEVICE" remove_partitions
|
||||
|
||||
# Create 1 primary partitions on CACHE_DEVICE
|
||||
TARGET_DEVICE_OPTION="$CACHE_DEVICE" PARTITION_SIZE_OPTION=$CACHE_DEVICE_SIZE PARTITION_IDS_OPTION="1" make_primary_partitions
|
||||
|
||||
# Create 1 primary partitions on CORE_DEVICE
|
||||
TARGET_DEVICE_OPTION="$CORE_DEVICE" PARTITION_SIZE_OPTION=$CORE_DEVICE_SIZE PARTITION_IDS_OPTION="1" make_primary_partitions
|
||||
|
||||
declare -a MODE=("wt" "wa")
|
||||
|
||||
echo "------Test read from cache"
|
||||
|
||||
for mode in "${MODE[@]}"
|
||||
do
|
||||
echo "------Start CAS Linux in $mode mode"
|
||||
|
||||
# This is where the real test starts
|
||||
CACHE_ID_OPTION="1" CACHE_DEVICE_OPTION="${CACHE_DEVICE}"1 CACHE_MODE_OPTION="$mode" start_cache
|
||||
|
||||
CACHE_ID_OPTION="1" CORE_DEVICE_OPTION="${CORE_DEVICE}"1 add_core
|
||||
sleep 2
|
||||
|
||||
# iostat read
|
||||
TMP_CACHE_DEVICE=$(echo "${CACHE_DEVICE}" | cut -c6-)
|
||||
run_cmd "dd if=/dev/cas1-1 of=$TMP_DIR/file001.bin bs=$BLOCK_SIZE count=$COUNT skip=10000 iflag=direct"
|
||||
READ_CACHE_1=$(iostat "${CACHE_DEVICE}" | grep $TMP_CACHE_DEVICE | awk 'NR==1 {print $5}')
|
||||
run_cmd "dd if=/dev/cas1-1 of=$TMP_DIR/file001.bin bs=$BLOCK_SIZE count=$COUNT skip=10000 iflag=direct"
|
||||
READ_CACHE_2=$(iostat "${CACHE_DEVICE}" | grep $TMP_CACHE_DEVICE | awk 'NR==1 {print $5}')
|
||||
READ_CACHE_DELTA=$((($READ_CACHE_2-$READ_CACHE_1)*IOSTAT_BLOCK_SIZE))
|
||||
DATA_READ=$(($COUNT*$BLOCK_SIZE))
|
||||
if [ $READ_CACHE_DELTA -eq $DATA_READ ] ; then
|
||||
echo -n "Blocks read from cache:$READ_CACHE_DELTA == $DATA_READ"; success
|
||||
else
|
||||
echo -n "Blocks read from cache:$READ_CACHE_DELTA != $DATA_READ"; error
|
||||
L_TEST_STATUS=1
|
||||
fi
|
||||
|
||||
# Clear up after test
|
||||
CACHE_ID_OPTION="1" stop_cache
|
||||
done
|
||||
|
||||
echo "------Test write and than read from cache"
|
||||
|
||||
for mode in "${MODE[@]}"
|
||||
do
|
||||
echo "------Start CAS Linux in $mode mode"
|
||||
|
||||
# This is where the real test starts
|
||||
CACHE_ID_OPTION="1" CACHE_DEVICE_OPTION="${CACHE_DEVICE}"1 CACHE_MODE_OPTION="$mode" start_cache
|
||||
|
||||
CACHE_ID_OPTION="1" CORE_DEVICE_OPTION="${CORE_DEVICE}"1 add_core
|
||||
sleep 2
|
||||
|
||||
# iostat write and write
|
||||
TMP_CORE_DEVICE=$(echo "${CORE_DEVICE}" | cut -c6-)
|
||||
WRITE_CORE_0=$(iostat "${CORE_DEVICE}" | grep $TMP_CORE_DEVICE | awk 'NR==1 {print $6}')
|
||||
WRITE_CACHE_0=$(iostat "${CACHE_DEVICE}" | grep $TMP_CACHE_DEVICE | awk 'NR==1 {print $6}')
|
||||
run_cmd "dd if=$TMP_DIR/file001.bin of=/dev/cas1-1 bs=$BLOCK_SIZE count=$COUNT seek=20000 oflag=direct"
|
||||
WRITE_CORE_1=$(iostat "${CORE_DEVICE}" | grep $TMP_CORE_DEVICE | awk 'NR==1 {print $6}')
|
||||
WRITE_CACHE_1=$(iostat "${CACHE_DEVICE}" | grep $TMP_CACHE_DEVICE | awk 'NR==1 {print $6}')
|
||||
READ_CORE_1=$(iostat "${CORE_DEVICE}" | grep $TMP_CORE_DEVICE | awk 'NR==1 {print $5}')
|
||||
READ_CACHE_1=$(iostat "${CACHE_DEVICE}" | grep $TMP_CACHE_DEVICE | awk 'NR==1 {print $5}')
|
||||
WRITE_CORE_DELTA_1=$((($WRITE_CORE_1-$WRITE_CORE_0)*IOSTAT_BLOCK_SIZE))
|
||||
WRITE_CACHE_DELTA_1=$((($WRITE_CACHE_1-$WRITE_CACHE_0)*IOSTAT_BLOCK_SIZE))
|
||||
run_cmd "dd if=/dev/cas1-1 of=$TMP_DIR/file001.bin bs=$BLOCK_SIZE count=$COUNT skip=20000 iflag=direct"
|
||||
READ_CORE_2=$(iostat "${CORE_DEVICE}" | grep $TMP_CORE_DEVICE | awk 'NR==1 {print $5}')
|
||||
READ_CACHE_2=$(iostat "${CACHE_DEVICE}" | grep $TMP_CACHE_DEVICE | awk 'NR==1 {print $5}')
|
||||
READ_CORE_DELTA_2=$((($READ_CORE_2-$READ_CORE_1)*IOSTAT_BLOCK_SIZE))
|
||||
READ_CACHE_DELTA_2=$((($READ_CACHE_2-$READ_CACHE_1)*IOSTAT_BLOCK_SIZE))
|
||||
DATA_WRITE=$(($COUNT*$BLOCK_SIZE))
|
||||
|
||||
# Verify writes on both cache and core
|
||||
if [ "$mode" == "wa" ] ; then
|
||||
if [ $WRITE_CORE_DELTA_1 -eq $DATA_WRITE ]; then
|
||||
echo -n "Blocks write to core: $WRITE_CORE_DELTA_1 == $DATA_WRITE"; success
|
||||
else
|
||||
echo -n "Blocks write to core: $WRITE_CORE_DELTA_1 != $DATA_WRITE"; error
|
||||
L_TEST_STATUS=1
|
||||
fi
|
||||
if [ $WRITE_CACHE_DELTA_1 -eq 0 ]; then
|
||||
echo -n "Blocks write to cache: $WRITE_CACHE_DELTA_1 == 0"; success
|
||||
else
|
||||
echo -n "Blocks write to cache: $WRITE_CACHE_DELTA_1 != 0"; error
|
||||
L_TEST_STATUS=1
|
||||
fi
|
||||
else
|
||||
if [ $WRITE_CORE_DELTA_1 -eq $DATA_WRITE ]; then
|
||||
echo -n "Blocks write to core: $WRITE_CORE_DELTA_1 == $DATA_WRITE"; success
|
||||
else
|
||||
echo -n "Blocks write to core: $WRITE_CORE_DELTA_1 != $DATA_WRITE"; error
|
||||
L_TEST_STATUS=1
|
||||
fi
|
||||
if [ $WRITE_CACHE_DELTA_1 -eq $DATA_WRITE ]; then
|
||||
echo -n "Blocks write to cache: $WRITE_CACHE_DELTA_1 == $DATA_WRITE"; success
|
||||
else
|
||||
echo -n "Blocks write to cache: $WRITE_CACHE_DELTA_1 != $DATA_WRITE"; error
|
||||
L_TEST_STATUS=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Verify reads on both cache and core
|
||||
if [ "$mode" == "wa" ] ; then
|
||||
if [ $READ_CORE_DELTA_2 -eq $DATA_WRITE ]; then
|
||||
echo -n "Blocks read from core: $READ_CORE_DELTA_2 == $DATA_WRITE"; success
|
||||
else
|
||||
echo -n "Blocks read from core: $READ_CORE_DELTA_2 != $DATA_WRITE"; error
|
||||
L_TEST_STATUS=1
|
||||
fi
|
||||
if [ $READ_CACHE_DELTA_2 -eq 0 ]; then
|
||||
echo -n "Blocks read from cache: $READ_CACHE_DELTA_2 == 0"; success
|
||||
else
|
||||
if [ $READ_CACHE_DELTA_2 -eq 4096 ]; then
|
||||
echo -n "Blocks read from cache: $READ_CACHE_DELTA_2 == 4096"; success
|
||||
else
|
||||
echo -n "Blocks read from cache: $READ_CACHE_DELTA_2 != 0"; error
|
||||
L_TEST_STATUS=1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ $READ_CORE_DELTA_2 -eq 0 ]; then
|
||||
echo -n "Blocks read from core: $READ_CORE_DELTA_2 == 0"; success
|
||||
else
|
||||
echo -n "Blocks read from core: $READ_CORE_DELTA_2 != 0"; error
|
||||
L_TEST_STATUS=1
|
||||
fi
|
||||
if [ $READ_CACHE_DELTA_2 -ge $DATA_WRITE ]; then
|
||||
echo -n "Blocks read from cache: $READ_CACHE_DELTA_2 >= $DATA_WRITE"; success
|
||||
else
|
||||
echo -n "Blocks read from cache: $READ_CACHE_DELTA_2 != $DATA_WRITE"; error
|
||||
L_TEST_STATUS=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Clear up after test
|
||||
CACHE_ID_OPTION="1" stop_cache
|
||||
done
|
||||
|
||||
# Always return 0 at the end of the test - if at any point something has failed
|
||||
# in the API functions, test will end and return a proper result.
|
||||
# If you need to check other things during the test and end the test earlier, you
|
||||
# should end the test using "end_test $retval" function
|
||||
end_test $L_TEST_STATUS
|
38
test/smoke_test/basic/09
Executable file
38
test/smoke_test/basic/09
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2019 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
# The line below specified that line under it should be used as the test's short description when launching test via run_tests script.
|
||||
# The text should not be longer than 80 chars - if it is, the script will strip addititonal characters
|
||||
# DESCRIPTION Validate spelling in manpage
|
||||
|
||||
# USE_IN_NIGHTLY
|
||||
|
||||
# Standard beginning for every test - get the main tests directory and
|
||||
# link the cas_lib file for CAS API, then use "start_test $*" to pass params
|
||||
# and do other necessary checks and setup
|
||||
TESTS_DIR="$(dirname $0)/../"
|
||||
. $TESTS_DIR/cas_lib
|
||||
start_test $*
|
||||
|
||||
FAIL=0
|
||||
|
||||
PERSONAL_DICTIONARY=`pwd`/cas_ex.en.pws
|
||||
|
||||
man --help | grep -- --no-hyphenation 2>&1 > /dev/null
|
||||
if [ $? -ne 0 ] ; then
|
||||
warning "option --no-hyphenation not supported by man"
|
||||
end_test $CAS_TEST_NOT_RUN
|
||||
fi
|
||||
|
||||
run_cmd "man --no-hyphenation $CAS_MAN_PAGE | head -n -1 | aspell list --lang=en_US --add-extra-dicts=$PERSONAL_DICTIONARY"
|
||||
for N in $OUTPUT ; do
|
||||
if [ -n $N ] ; then
|
||||
FAIL=1
|
||||
error "Misspelled word: $N"
|
||||
fi
|
||||
done
|
||||
|
||||
end_test $FAIL
|
38
test/smoke_test/basic/10
Executable file
38
test/smoke_test/basic/10
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2019 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
# The line below specified that line under it should be used as the test's short description when launching test via run_tests script.
|
||||
# The text should not be longer than 80 chars - if it is, the script will strip addititonal characters
|
||||
# DESCRIPTION Verify cache start in different modes
|
||||
|
||||
# The line below says that this test should be included in BVT - it will be launched, when we use "./run_tests -b"
|
||||
# USE_IN_BVT
|
||||
|
||||
# Standard beginning for every test - get the main tests directory and
|
||||
# link the cas_lib file for CAS API, then use "start_test $*" to pass params
|
||||
# and do other necessary checks and setup
|
||||
TESTS_DIR="$(dirname $0)/../"
|
||||
. $TESTS_DIR/cas_lib
|
||||
start_test $*
|
||||
|
||||
# This is where the real test starts
|
||||
basic_i() {
|
||||
echo -n ""
|
||||
}
|
||||
|
||||
# Test if the APP exists, if it has option "--version" and if it returns a correct status
|
||||
NUMBER_OF_CORE_PARTITIONS="2"
|
||||
NUMBER_OF_CACHE_PARTITIONS="2"
|
||||
CACHE_FORCE_OPTION="yes"
|
||||
CACHE_LINE_SIZE="all"
|
||||
CACHE_MODE_OPTION="all"
|
||||
iteration basic_i
|
||||
|
||||
# Always return 0 at the end of the test - if at any point something has failed
|
||||
# in the API functions, test will end and return a proper result.
|
||||
# If you need to check other things during the test and end the test earlier, you
|
||||
# should end the test using "end_test $retval" function
|
||||
end_test 0
|
48
test/smoke_test/basic/11
Executable file
48
test/smoke_test/basic/11
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2019 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
# The line below specified that line under it should be used as the test's short description when launching test via run_tests script.
|
||||
# The text should not be longer than 80 chars - if it is, the script will strip addititonal characters
|
||||
# DESCRIPTION Multi level cache assembly
|
||||
|
||||
# USE_IN_NIGHTLY
|
||||
|
||||
# Standard beginning for every test - get the main tests directory and
|
||||
# link the cas_lib file for CAS API, then use "start_test $*" to pass params
|
||||
# and do other necessary checks and setup
|
||||
TESTS_DIR="$(dirname $0)/../"
|
||||
. $TESTS_DIR/cas_lib
|
||||
start_test $*
|
||||
|
||||
# This is where the real test starts
|
||||
|
||||
# Use CACHE_DEVICE provided by configuration file and remove partitions from this device
|
||||
TARGET_DEVICE_OPTION="$CACHE_DEVICE" remove_partitions
|
||||
|
||||
# Create three primary partitions of size 2000M on CACHE_DEVICE
|
||||
TARGET_DEVICE_OPTION="$CACHE_DEVICE" PARTITION_SIZE_OPTION="2000M" PARTITION_IDS_OPTION="1 2 3" make_primary_partitions
|
||||
# Creare one primary partition of size 4000M on CORE DEVICE
|
||||
TARGET_DEVICE_OPTION="$CORE_DEVICE" PARTITION_SIZE_OPTION="4000M" PARTITION_IDS_OPTION="1" make_primary_partitions
|
||||
|
||||
# Start caches
|
||||
CACHE_ID_OPTION="1" CACHE_DEVICE_OPTION="${CACHE_DEVICE}1" start_cache
|
||||
CACHE_ID_OPTION="2" CACHE_DEVICE_OPTION="${CACHE_DEVICE}2" start_cache
|
||||
CACHE_ID_OPTION="3" CACHE_DEVICE_OPTION="${CACHE_DEVICE}3" start_cache
|
||||
|
||||
#Assembly multi-level cache (add cores)
|
||||
CACHE_ID_OPTION="1" CORE_DEVICE_OPTION="${CORE_DEVICE}1" add_core
|
||||
CACHE_ID_OPTION="2" CORE_DEVICE_OPTION="${DEVICE_NAME}1-1" add_core
|
||||
CACHE_ID_OPTION="3" CORE_DEVICE_OPTION="${DEVICE_NAME}2-1" add_core
|
||||
|
||||
# Clear up after test
|
||||
CACHE_ID_OPTION="3" stop_cache
|
||||
CACHE_ID_OPTION="2" stop_cache
|
||||
CACHE_ID_OPTION="1" stop_cache
|
||||
# Always return 0 at the end of the test - if at any point something has failed
|
||||
# in the API functions, test will end and return a proper result.
|
||||
# If you need to check other things during the test and end the test earlier, you
|
||||
# should end the test using "end_test $retval" function
|
||||
end_test 0
|
85
test/smoke_test/basic/12
Executable file
85
test/smoke_test/basic/12
Executable file
@@ -0,0 +1,85 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright(c) 2012-2019 Intel Corporation
|
||||
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
#
|
||||
|
||||
# The line below specified that line under it should be used as the test's short description when launching test via run_tests script.
|
||||
# The text should not be longer than 80 chars - if it is, the script will strip addititonal characters
|
||||
# DESCRIPTION WriteBack mode test: Test files on core devices with different filesystems after flushing and stopping cache
|
||||
# with 'don't flush dirty data on exit' option.
|
||||
|
||||
# USE_IN_NIGHTLY
|
||||
# USE_IN_BVT
|
||||
# Standard beginning for every test - get the main tests directory and
|
||||
# link the cas_lib file for CAS API, then use "start_test $*" to pass params
|
||||
# and do other necessary checks and setup
|
||||
TESTS_DIR="$(dirname $0)/../"
|
||||
. $TESTS_DIR/cas_lib
|
||||
start_test $*
|
||||
|
||||
# This is where the real test starts
|
||||
|
||||
# Use CACHE_DEVICE and CORE_DEVICE provided by configuration file and remove partitions from those devices
|
||||
TARGET_DEVICE_OPTION="$CACHE_DEVICE" remove_partitions
|
||||
TARGET_DEVICE_OPTION="$CORE_DEVICE" remove_partitions
|
||||
|
||||
# Create 3 primary partitions on CACHE_DEVICE, each of 2000M size
|
||||
TARGET_DEVICE_OPTION="$CACHE_DEVICE" PARTITION_SIZE_OPTION="2000M" PARTITION_IDS_OPTION="1 2 3" make_primary_partitions
|
||||
# Create 3 primary partitions on CORE_DEVICE, each of 4000M size
|
||||
TARGET_DEVICE_OPTION="$CORE_DEVICE" PARTITION_SIZE_OPTION="4000M" PARTITION_IDS_OPTION="1 2 3" make_primary_partitions
|
||||
|
||||
# Start cache on CACHE_DEVICE1 (/dev/sdd1, for example) with ID=1 and add a core device using CORE_DEVICE1 (/dev/sde1, for example)
|
||||
CACHE_ID_OPTION="1" CACHE_DEVICE_OPTION="${CACHE_DEVICE}1" CACHE_FORCE_OPTION="1" CACHE_MODE_OPTION="wb" start_cache
|
||||
CACHE_ID_OPTION="1" CORE_DEVICE_OPTION="${CORE_DEVICE}1" add_core
|
||||
|
||||
# Start cache on CACHE_DEVICE2 (/dev/sdd2, for example) with ID=2 and add a core device using CORE_DEVICE2 (/dev/sde2, for example)
|
||||
CACHE_ID_OPTION="2" CACHE_DEVICE_OPTION="${CACHE_DEVICE}2" CACHE_FORCE_OPTION="1" CACHE_MODE_OPTION="wb" start_cache
|
||||
CACHE_ID_OPTION="2" CORE_DEVICE_OPTION="${CORE_DEVICE}2" add_core
|
||||
|
||||
# Start cache on CACHE_DEVICE3 (/dev/sdd3, for example) with ID=3 and add a core device using CORE_DEVICE3 (/dev/sde3, for example)
|
||||
CACHE_ID_OPTION="3" CACHE_DEVICE_OPTION="${CACHE_DEVICE}3" CACHE_FORCE_OPTION="1" CACHE_MODE_OPTION="wb" start_cache
|
||||
CACHE_ID_OPTION="3" CORE_DEVICE_OPTION="${CORE_DEVICE}3" add_core
|
||||
|
||||
# Create filesystems on cached devices - we do this using run_cmd because it is not in the API (and probably won't be).
|
||||
# The test framework will accept invoking the commands directly (e.g. "mkfs.ext3 [...]" without the "run_cmd"), but the
|
||||
# results have to be checked manually by the test.
|
||||
TARGET_DEVICE_OPTION="${DEVICE_NAME}1-1" FILESYSTEM_TYPE="ext3" make_filesystem
|
||||
TARGET_DEVICE_OPTION="${DEVICE_NAME}2-1" FILESYSTEM_TYPE="ext4" make_filesystem
|
||||
TARGET_DEVICE_OPTION="${DEVICE_NAME}3-1" FILESYSTEM_TYPE="xfs" make_filesystem
|
||||
|
||||
# Specify a temporary file used for md5sums - note that it resides in $TMP_DIR, which is a special directory defined in cas_config.
|
||||
# Everytime we use temporary files, they should be placed in that special directory. Its contents are cleared after every test.
|
||||
MD5_FILE="$TMP_DIR/cas_md5_sum_"
|
||||
|
||||
# Mount the filesystems, then create the example files and save their MD5 sums locally in the temporary place
|
||||
# Note the usage of ${MOUNTPOINT} - mount_cache always mounts using following formula: ${MOUNTPOINT}-${CACHE_ID_OPTION}-${CORE_ID_OPTION}.
|
||||
for ID in 1 2 3 ; do
|
||||
CACHE_ID_OPTION="$ID" CORE_ID_OPTION="1" mount_cache
|
||||
run_cmd "dd if=/dev/urandom of=${MOUNTPOINT}-${ID}-1/test bs=50M count=1"
|
||||
run_cmd "md5sum ${MOUNTPOINT}-${ID}-1/test > ${MD5_FILE}_${ID}"
|
||||
done
|
||||
|
||||
# Umount & stop the caches, then mount the core devices
|
||||
# Note the usage of ${MOUNTPOINT} - mount_cache always mounts using following formula: ${MOUNTPOINT}-${CACHE_ID_OPTION}-${CORE_ID_OPTION}.
|
||||
for ID in 1 2 3 ; do
|
||||
run_cmd "umount ${MOUNTPOINT}-${ID}-1"
|
||||
CACHE_ID_OPTION="$ID" flush_cache
|
||||
CACHE_ID_OPTION="$ID" CACHE_DONT_FLUSH_DATA_OPTION="1" stop_cache
|
||||
run_cmd dd if=/dev/zero of="${CACHE_DEVICE}${ID}" bs=1M count=1 oflag=direct
|
||||
run_cmd "mount ${CORE_DEVICE}${ID} ${MOUNTPOINT}-${ID}-1"
|
||||
done
|
||||
|
||||
# Now check for files' presence and umount core devices
|
||||
# Note the usage of ${MOUNTPOINT} - mount_cache always mounts using following formula: ${MOUNTPOINT}-${CACHE_ID_OPTION}-${CORE_ID_OPTION}.
|
||||
for ID in 1 2 3 ; do
|
||||
run_cmd "test -f ${MOUNTPOINT}-${ID}-1/test"
|
||||
run_cmd "md5sum -c ${MD5_FILE}_${ID}"
|
||||
run_cmd "umount ${MOUNTPOINT}-${ID}-1"
|
||||
done
|
||||
|
||||
# Always return 0 at the end of the test - if at any point something has failed
|
||||
# in the API functions, test will end and return a proper result.
|
||||
# If you need to check other things during the test and end the test earlier, you
|
||||
# should end the test using "end_test $retval" function
|
||||
end_test 0
|
Reference in New Issue
Block a user