Skip to content

Commit 44d6ae0

Browse files
committed
Make sure size_test CI uses -Wall -Werror
1 parent 88886b8 commit 44d6ae0

File tree

6 files changed

+17
-9
lines changed

6 files changed

+17
-9
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@ must work with threading**
215215

216216
## Testing
217217

218+
### Running Tests
219+
220+
The `sh test/build_size_test.sh` script will compile the runtime along with portable kernels.
221+
The `test/run_oss_cpp_tests.sh` script will build and run C++ tests locally.
222+
218223
### Writing Tests
219224
To help keep code quality high, ExecuTorch uses a combination of unit tests and
220225
end-to-end (e2e) tests. If you add a new feature or fix a bug, please add tests
@@ -229,8 +234,6 @@ If it's not clear how to add a test for your PR, take a look at the blame for
229234
the code you're modifying and find an author who has more context. Ask them
230235
for their help in the PR comments.
231236

232-
The `test/run_oss_cpp_tests.sh` script will build and run C++ tests locally.
233-
234237
### Continuous Integration
235238
See https://hud.pytorch.org/hud/pytorch/executorch/main for the current state of
236239
the CI (continuous integration) jobs. If `main` is broken, consider rebasing

kernels/portable/cpu/op_full.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ Tensor& full_out(
3838

3939
ET_SWITCH_SCALAR_OBJ_TYPES(val_type, ctx, name, CTYPE_VAL, [&] {
4040
CTYPE_VAL val;
41-
utils::extract_scalar(fill_value, &val);
41+
ET_KERNEL_CHECK(
42+
ctx, utils::extract_scalar(fill_value, &val), InvalidArgument, );
4243

4344
ET_SWITCH_REALHBBF16_TYPES(out_type, ctx, name, CTYPE_OUT, [&] {
4445
CTYPE_OUT val_casted = static_cast<CTYPE_OUT>(val);

kernels/portable/cpu/op_full_like.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ Tensor& full_like_out(
5454

5555
ET_SWITCH_REALB_TYPES(val_type, ctx, name, CTYPE_VAL, [&] {
5656
CTYPE_VAL val;
57-
utils::extract_scalar(fill_value, &val);
57+
ET_KERNEL_CHECK(
58+
ctx, utils::extract_scalar(fill_value, &val), InvalidArgument, );
5859

5960
ET_SWITCH_REALHBBF16_TYPES(out_type, ctx, name, CTYPE_OUT, [&] {
6061
CTYPE_OUT val_casted = static_cast<CTYPE_OUT>(val);

kernels/portable/cpu/op_scatter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Tensor& scatter_value_out(
156156

157157
ET_SWITCH_SCALAR_OBJ_TYPES(val_type, ctx, name, CTYPE_VAL, [&] {
158158
CTYPE_VAL val;
159-
utils::extract_scalar(value, &val);
159+
ET_KERNEL_CHECK(ctx, utils::extract_scalar(value, &val), InvalidArgument, );
160160

161161
ET_SWITCH_REALHBBF16_TYPES(in.scalar_type(), ctx, name, CTYPE, [&]() {
162162
scatter_value_helper<CTYPE>(in, dim, index, val, out);

runtime/kernel/operator_registry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void make_kernel_key_string(Span<const TensorMeta> key, char* buf) {
135135
// If no tensor is present in an op, kernel key does not apply
136136
return;
137137
}
138-
strncpy(buf, "v1/", 3);
138+
strcpy(buf, "v1/");
139139
buf += 3;
140140
for (size_t i = 0; i < key.size(); i++) {
141141
auto& meta = key[i];

test/build_size_test.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ set -e
1111
# shellcheck source=/dev/null
1212
source "$(dirname "${BASH_SOURCE[0]}")/../.ci/scripts/utils.sh"
1313

14+
# Remove -Wno-sign-compare (https://github.com/pytorch/executorch/issues/8149)
15+
COMMON_CXXFLAGS="-fno-exceptions -fno-rtti -Wall -Werror -Wno-sign-compare -Wno-unknown-pragmas"
16+
1417
cmake_install_executorch_lib() {
1518
echo "Installing libexecutorch.a"
1619
clean_executorch_install_folders
17-
18-
CXXFLAGS="-fno-exceptions -fno-rtti" retry cmake -DBUCK2="$BUCK2" \
20+
21+
CXXFLAGS="$COMMON_CXXFLAGS" retry cmake -DBUCK2="$BUCK2" \
1922
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
2023
-DCMAKE_INSTALL_PREFIX=cmake-out \
2124
-DCMAKE_BUILD_TYPE=Release \
@@ -27,7 +30,7 @@ cmake_install_executorch_lib() {
2730
}
2831

2932
test_cmake_size_test() {
30-
CXXFLAGS="-fno-exceptions -fno-rtti" retry cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=cmake-out -Bcmake-out/test test
33+
CXXFLAGS="$COMMON_CXXFLAGS" retry cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=cmake-out -Bcmake-out/test test
3134

3235
echo "Build size test"
3336
cmake --build cmake-out/test -j9 --config Release

0 commit comments

Comments
 (0)