Skip to content

Commit e2bc39b

Browse files
authored
Init runtime PAL in RunnerTest (forward fix for D108707577) (#20319)
Summary: Forward fix for D108707577 (llm_runner: plumb prefill temperature, #20244). The new test RunnerTest.TextTokenGeneratorRejectsTemperatureOutOfRange aborts: [ RUN ] RunnerTest.TextTokenGeneratorRejectsTemperatureOutOfRange ExecuTorch PAL must be initialized before call to et_pal_current_ticks() *** Signal 6 (SIGABRT) *** The new test drives the temperature-rejection path, which emits an ET_LOG (and thus calls et_pal_current_ticks()) before any model load. The RunnerTest fixture never initializes the ExecuTorch runtime, so the timer call aborts. The valid- temperature tests in the same fixture pass because their happy path does not log. Fix: initialize the runtime in RunnerTest::SetUp(), matching the established pattern used by the sibling tests in this same directory (test_text_prefiller, test_util, test_wav_loader all call executorch::runtime::runtime_init() in SetUp()). Applied to both the fbcode and xplat copies. Differential Revision: D108831322
1 parent fa5fc74 commit e2bc39b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

extension/llm/runner/test/test_text_llm_runner.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <executorch/extension/llm/runner/text_token_generator.h>
1515
#include <executorch/extension/llm/sampler/logit_processor.h>
1616
#include <executorch/runtime/core/exec_aten/testing_util/tensor_factory.h>
17+
#include <executorch/runtime/platform/runtime.h>
1718
#include <gmock/gmock.h>
1819
#include <gtest/gtest.h>
1920

@@ -145,6 +146,10 @@ class CallbackCounter {
145146
// Test fixture for Runner tests - minimal setup
146147
class RunnerTest : public Test {
147148
protected:
149+
void SetUp() override {
150+
executorch::runtime::runtime_init();
151+
}
152+
148153
// Helper functions to create and set up mock objects
149154
std::unique_ptr<MockTokenizer> createMockTokenizer() {
150155
auto tokenizer = std::make_unique<MockTokenizer>();

0 commit comments

Comments
 (0)