Skip to content

Commit 5c07032

Browse files
authored
Merge pull request #77 from paritytech/mak/fix-bench-weights-file
Fix output file for updating weights in bench-bot.sh
2 parents b9c5ac8 + 8c41ee4 commit 5c07032

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

bench-bot.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,23 @@ bench_pallet() {
9494
fi
9595
local weights_dir="./runtime/${runtime_dir}/src/weights"
9696

97-
# translates e.g. "pallet_foo::bar" to "pallet_foo_bar"
98-
local output_file="${pallet//::/_}"
97+
local output_file=""
98+
if [[ $pallet == *"::"* ]]; then
99+
# translates e.g. "pallet_foo::bar" to "pallet_foo_bar"
100+
output_file="${pallet//::/_}.rs"
101+
fi
99102

100103
case "$kind" in
101104
runtime)
102105
args+=(
103106
--header=./file_header.txt
104-
--output="${weights_dir}/${output_file}.rs"
107+
--output="${weights_dir}/${output_file}"
105108
)
106109
;;
107110
xcm)
108111
args+=(
109112
--template=./xcm/pallet-xcm-benchmarks/template.hbs
110-
--output="${weights_dir}/xcm/${output_file}.rs"
113+
--output="${weights_dir}/xcm/${output_file}"
111114
)
112115
;;
113116
*)
@@ -129,20 +132,23 @@ bench_pallet() {
129132
--header=./file_header.txt
130133
)
131134

132-
# translates e.g. "pallet_foo::bar" to "pallet_foo_bar"
133-
local output_file="${pallet//::/_}"
135+
local output_file=""
136+
if [[ $pallet == *"::"* ]]; then
137+
# translates e.g. "pallet_foo::bar" to "pallet_foo_bar"
138+
output_file="${pallet//::/_}.rs"
139+
fi
134140

135141
case "$kind" in
136142
pallet)
137143
args+=(
138-
--output="./parachains/runtimes/$chain_type/$runtime/src/weights/${output_file}.rs"
144+
--output="./parachains/runtimes/$chain_type/$runtime/src/weights/${output_file}"
139145
)
140146
;;
141147
xcm)
142148
mkdir -p "./parachains/runtimes/$chain_type/$runtime/src/weights/xcm"
143149
args+=(
144150
--template=./templates/xcm-bench-template.hbs
145-
--output="./parachains/runtimes/$chain_type/$runtime/src/weights/xcm/${output_file}.rs"
151+
--output="./parachains/runtimes/$chain_type/$runtime/src/weights/xcm/${output_file}"
146152
)
147153
;;
148154
*)

0 commit comments

Comments
 (0)