testing: Improve replacing IP addresses in test files
There are a lot of files without patterns and running them all through sed is quite slow. Using grep first makes this quicker (about 0.5s per test). Ignoring PEM files is also helpful.
This commit is contained in:
@@ -194,10 +194,6 @@ function searchandreplace {
|
||||
# search and replace in each found file the
|
||||
# given string
|
||||
#
|
||||
|
||||
for eachfoundfile in `find $DESTDIR -type f`
|
||||
do
|
||||
sed -i -e "s/$SEARCHSTRING/$REPLACESTRING/g" "$eachfoundfile"
|
||||
done
|
||||
|
||||
grep -rlZ --exclude='*.pem' "$SEARCHSTRING" $DESTDIR | \
|
||||
xargs -0 -I@ sed -i -e "s/$SEARCHSTRING/$REPLACESTRING/g" @
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user