Skip to content

Commit

Permalink
dpdk-build-test: simplify enable and disable configs
Browse files Browse the repository at this point in the history
Just use 'sed -i' to simplify the functions. Although
'mv' after 'sed' can avoid corruption of the original
file, but 'sed -i' is enough here.

Suggested-by: Yuanhan Liu <[email protected]>
Signed-off-by: Wanlong Gao <[email protected]>
Signed-off-by: Fengguang Wu <[email protected]>
  • Loading branch information
gaowanlong authored and Fengguang Wu committed May 20, 2015
1 parent 4dea1e7 commit 6c76ebe
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions tests/dpdk-build-test
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,19 @@ chmod -R 777 /tmp/DPDK_Builds/${ChaseBranch}
default_gcc_target=x86_64-native-linuxapp-gcc
feature_gcc_target=x86_64-ivshmem-linuxapp-gcc

# borrow from linux/script/config
txt_subst()
{
local before="$1"
local after="$2"
local infile="$3"
local tmpfile="$infile.swp"

sed -e "s:$before:$after:" "$infile" >"$tmpfile"
# replace original file with the edited one
mv "$tmpfile" "$infile"
}

enable_configs()
{
for config in $@
do
txt_subst "^CONFIG_$config=.*" "CONFIG_$config=y" "config/common_linuxapp"
sed -i -e "s:^\(CONFIG_$config=\).*:\1y" config/common_linuxapp
done
}

disable_configs()
{
for config in $@
do
txt_subst "^CONFIG_$config=.*" "CONFIG_$config=n" "config/common_linuxapp"
sed -i -e "s:^\(CONFIG_$config=\).*:\1n" config/common_linuxapp
done
}

Expand Down

0 comments on commit 6c76ebe

Please sign in to comment.