Skip to content

Commit 80472ee

Browse files
authored
Remove hexdump_test.cc from source list (#3094)
As a unit test, it belongs on MICROLITE_TEST_SRCS, which gets filtered out of MICROLITE_CC_SRCS. Keeping it on the source list results in it being compiled into the tflm archive, where its main() function conflicts with the application's main. Also, since hexdump.cc calls DebugVsnprintf(), we need to define it in debug_log.cc, also when TF_LITE_STRIP_ERROR_STRINGS is #defined, else compilation fails. Move the #ifdef TF_LITE_STRIP_ERROR_STRINGS to be inside the function implementation, rather around the whole function. BUG=384562154
1 parent 5f0db34 commit 80472ee

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

tensorflow/lite/micro/hexdump.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616

1717
#include <algorithm>
1818
#include <cctype>
19+
#include <cstdarg>
1920

20-
#include "tensorflow/lite/micro/debug_log.h"
21+
#include "tensorflow/lite/micro/micro_log.h"
2122
#include "tensorflow/lite/micro/static_vector.h"
2223

2324
namespace {
@@ -35,10 +36,10 @@ tflite::Span<char> output(const tflite::Span<char>& buf, const char* format,
3536
va_start(args, format);
3637

3738
if (buf.data() == nullptr) {
38-
DebugLog(format, args);
39+
VMicroPrintf(format, args);
3940
result = {nullptr, 0};
4041
} else {
41-
size_t len = DebugVsnprintf(buf.data(), buf.size(), format, args);
42+
size_t len = MicroVsnprintf(buf.data(), buf.size(), format, args);
4243
// Returns the number of characters that would have been written if
4344
// there were enough room, so cap it at the size of the buffer in order to
4445
// know how much was actually written.

tensorflow/lite/micro/tools/make/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ $(wildcard $(TENSORFLOW_ROOT)tensorflow/lite/micro/tools/benchmarking/*benchmark
333333
MICROLITE_TEST_SRCS := \
334334
$(TENSORFLOW_ROOT)tensorflow/lite/micro/fake_micro_context_test.cc \
335335
$(TENSORFLOW_ROOT)tensorflow/lite/micro/flatbuffer_utils_test.cc \
336+
$(TENSORFLOW_ROOT)tensorflow/lite/micro/hexdump_test.cc \
336337
$(TENSORFLOW_ROOT)tensorflow/lite/micro/memory_arena_threshold_test.cc \
337338
$(TENSORFLOW_ROOT)tensorflow/lite/micro/memory_helpers_test.cc \
338339
$(TENSORFLOW_ROOT)tensorflow/lite/micro/micro_allocator_test.cc \

tensorflow/lite/micro/tools/make/targets/bluepill_makefile.inc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,14 @@ MICROLITE_CC_SRCS := $(filter-out $(EXCLUDED_SRCS), $(MICROLITE_CC_SRCS))
7777
# which use std::vector constructor which then invokes new.
7878
# Excludes memory_arena_threshold_test because the size difference of some
7979
# allocator classes between different architectures.
80+
# Excludes hexdump_test because it fails in release model when MicroVsnprintf
81+
# isn't defined.
8082
# TODO(b/158651472): Fix the memory_arena_threshold_test
83+
# TODO(b/b/410801324): Fix hexdump_test for Bluepill
8184
EXCLUDED_TESTS := \
8285
$(TENSORFLOW_ROOT)tensorflow/lite/micro/micro_allocator_test.cc \
83-
$(TENSORFLOW_ROOT)tensorflow/lite/micro/memory_arena_threshold_test.cc
86+
$(TENSORFLOW_ROOT)tensorflow/lite/micro/memory_arena_threshold_test.cc \
87+
$(TENSORFLOW_ROOT)tensorflow/lite/micro/hexdump_test.cc
8488

8589
# flatbuffer_utils_test is intentionaly disabled because the flexbuffer builder
8690
# uses dynamic memory.

0 commit comments

Comments
 (0)