1f08c3bdfSopenharmony_ci#!/bin/bash 2f08c3bdfSopenharmony_ci################################################################################ 3f08c3bdfSopenharmony_ci## ## 4f08c3bdfSopenharmony_ci## Copyright (c) Dan Carpenter., 2004 ## 5f08c3bdfSopenharmony_ci## ## 6f08c3bdfSopenharmony_ci## This program is free software; you can redistribute it and#or modify ## 7f08c3bdfSopenharmony_ci## it under the terms of the GNU General Public License as published by ## 8f08c3bdfSopenharmony_ci## the Free Software Foundation; either version 2 of the License, or ## 9f08c3bdfSopenharmony_ci## (at your option) any later version. ## 10f08c3bdfSopenharmony_ci## ## 11f08c3bdfSopenharmony_ci## This program is distributed in the hope that it will be useful, but ## 12f08c3bdfSopenharmony_ci## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ## 13f08c3bdfSopenharmony_ci## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ## 14f08c3bdfSopenharmony_ci## for more details. ## 15f08c3bdfSopenharmony_ci## ## 16f08c3bdfSopenharmony_ci## You should have received a copy of the GNU General Public License ## 17f08c3bdfSopenharmony_ci## along with this program; if not, write to the Free Software ## 18f08c3bdfSopenharmony_ci## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## 19f08c3bdfSopenharmony_ci## ## 20f08c3bdfSopenharmony_ci################################################################################ 21f08c3bdfSopenharmony_ci 22f08c3bdfSopenharmony_ci## DESCRIPTION: 23f08c3bdfSopenharmony_ci## This test creates 20 files (0 thru 19) and then shuffles them around, 24f08c3bdfSopenharmony_ci## deletes, and recreates them as fast as possible. This is all done in 25f08c3bdfSopenharmony_ci## an effort to test for race conditions in the filesystem code. This test 26f08c3bdfSopenharmony_ci## runs until killed or Ctrl-C'd. It is suggested that it run overnight 27f08c3bdfSopenharmony_ci## with preempt turned on to make the system more sensitive to race 28f08c3bdfSopenharmony_ci## conditions. 29f08c3bdfSopenharmony_ci 30f08c3bdfSopenharmony_ciMAX_FILES=20 31f08c3bdfSopenharmony_ciCLEAR_SECS=30 32f08c3bdfSopenharmony_ciDIR="$TMPDIR/race" 33f08c3bdfSopenharmony_ci 34f08c3bdfSopenharmony_ciexecute_test() 35f08c3bdfSopenharmony_ci{ 36f08c3bdfSopenharmony_ci[ -e $DIR ] || mkdir $DIR 37f08c3bdfSopenharmony_ci./fs_racer_file_create.sh $DIR $MAX_FILES & 38f08c3bdfSopenharmony_ci./fs_racer_file_create.sh $DIR $MAX_FILES & 39f08c3bdfSopenharmony_ci./fs_racer_file_create.sh $DIR $MAX_FILES & 40f08c3bdfSopenharmony_ci 41f08c3bdfSopenharmony_ci./fs_racer_dir_create.sh $DIR $MAX_FILES & 42f08c3bdfSopenharmony_ci./fs_racer_dir_create.sh $DIR $MAX_FILES & 43f08c3bdfSopenharmony_ci./fs_racer_dir_create.sh $DIR $MAX_FILES & 44f08c3bdfSopenharmony_ci 45f08c3bdfSopenharmony_ci./fs_racer_file_rename.sh $DIR $MAX_FILES & 46f08c3bdfSopenharmony_ci./fs_racer_file_rename.sh $DIR $MAX_FILES & 47f08c3bdfSopenharmony_ci./fs_racer_file_rename.sh $DIR $MAX_FILES & 48f08c3bdfSopenharmony_ci 49f08c3bdfSopenharmony_ci./fs_racer_file_link.sh $DIR $MAX_FILES & 50f08c3bdfSopenharmony_ci./fs_racer_file_link.sh $DIR $MAX_FILES & 51f08c3bdfSopenharmony_ci./fs_racer_file_link.sh $DIR $MAX_FILES & 52f08c3bdfSopenharmony_ci 53f08c3bdfSopenharmony_ci./fs_racer_file_symlink.sh $DIR $MAX_FILES & 54f08c3bdfSopenharmony_ci./fs_racer_file_symlink.sh $DIR $MAX_FILES & 55f08c3bdfSopenharmony_ci./fs_racer_file_symlink.sh $DIR $MAX_FILES & 56f08c3bdfSopenharmony_ci 57f08c3bdfSopenharmony_ci./fs_racer_file_concat.sh $DIR $MAX_FILES & 58f08c3bdfSopenharmony_ci./fs_racer_file_concat.sh $DIR $MAX_FILES & 59f08c3bdfSopenharmony_ci./fs_racer_file_concat.sh $DIR $MAX_FILES & 60f08c3bdfSopenharmony_ci 61f08c3bdfSopenharmony_ci./fs_racer_file_list.sh $DIR & 62f08c3bdfSopenharmony_ci./fs_racer_file_list.sh $DIR & 63f08c3bdfSopenharmony_ci./fs_racer_file_list.sh $DIR & 64f08c3bdfSopenharmony_ci 65f08c3bdfSopenharmony_ci./fs_racer_file_rm.sh $DIR $MAX_FILES & 66f08c3bdfSopenharmony_ci./fs_racer_file_rm.sh $DIR $MAX_FILES & 67f08c3bdfSopenharmony_ci./fs_racer_file_rm.sh $DIR $MAX_FILES & 68f08c3bdfSopenharmony_ci} 69f08c3bdfSopenharmony_ci 70f08c3bdfSopenharmony_ci 71f08c3bdfSopenharmony_ciusage() 72f08c3bdfSopenharmony_ci{ 73f08c3bdfSopenharmony_ci echo usage: fs_racer.sh -t DURATION [Execute the testsuite for given DURATION seconds] 74f08c3bdfSopenharmony_ci exit 0; 75f08c3bdfSopenharmony_ci} 76f08c3bdfSopenharmony_ci 77f08c3bdfSopenharmony_ci 78f08c3bdfSopenharmony_cicall_exit() 79f08c3bdfSopenharmony_ci{ 80f08c3bdfSopenharmony_ci echo \"Cleaning up\" 81f08c3bdfSopenharmony_ci killall fs_racer_file_create.sh 82f08c3bdfSopenharmony_ci killall fs_racer_dir_create.sh 83f08c3bdfSopenharmony_ci killall fs_racer_file_rm.sh 84f08c3bdfSopenharmony_ci killall fs_racer_file_rename.sh 85f08c3bdfSopenharmony_ci killall fs_racer_file_link.sh 86f08c3bdfSopenharmony_ci killall fs_racer_file_symlink.sh 87f08c3bdfSopenharmony_ci killall fs_racer_file_list.sh 88f08c3bdfSopenharmony_ci killall fs_racer_file_concat.sh 89f08c3bdfSopenharmony_ci rm -rf $DIR 90f08c3bdfSopenharmony_ci exit 0 91f08c3bdfSopenharmony_ci} 92f08c3bdfSopenharmony_ci 93f08c3bdfSopenharmony_ciwhile getopts :t: arg 94f08c3bdfSopenharmony_cido case $arg in 95f08c3bdfSopenharmony_ci t) execute_test 96f08c3bdfSopenharmony_ci sleep $OPTARG 97f08c3bdfSopenharmony_ci call_exit;; 98f08c3bdfSopenharmony_ci \?) usage;; 99f08c3bdfSopenharmony_ci esac 100f08c3bdfSopenharmony_cidone 101f08c3bdfSopenharmony_ci 102f08c3bdfSopenharmony_ciexit 0 103f08c3bdfSopenharmony_ci 104