2019-12-19 21:02:05 +08:00
|
|
|
/*
|
2020-01-13 21:47:05 +08:00
|
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
2019-12-19 21:02:05 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/os_interface/os_context.h"
|
2019-12-19 21:02:05 +08:00
|
|
|
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
|
|
|
using namespace NEO;
|
|
|
|
|
|
|
|
TEST(OSContext, whenCreatingDefaultOsContextThenExpectInitializedAlways) {
|
2020-03-04 06:33:31 +08:00
|
|
|
OsContext *osContext = OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
|
2019-12-19 21:02:05 +08:00
|
|
|
EXPECT_TRUE(osContext->isInitialized());
|
2020-03-04 06:33:31 +08:00
|
|
|
EXPECT_FALSE(osContext->isLowPriority());
|
|
|
|
EXPECT_FALSE(osContext->isInternalEngine());
|
|
|
|
EXPECT_FALSE(osContext->isRootDevice());
|
|
|
|
delete osContext;
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(OSContext, givenLowPriorityRootDeviceInternalAreTrueWhenCreatingDefaultOsContextThenExpectGettersTrue) {
|
|
|
|
OsContext *osContext = OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, true, true, true);
|
|
|
|
EXPECT_TRUE(osContext->isLowPriority());
|
|
|
|
EXPECT_TRUE(osContext->isInternalEngine());
|
|
|
|
EXPECT_TRUE(osContext->isRootDevice());
|
2019-12-19 21:02:05 +08:00
|
|
|
delete osContext;
|
|
|
|
}
|
2020-03-07 02:02:24 +08:00
|
|
|
|
|
|
|
TEST(OSContext, givenOsContextCreatedDefaultIsFalseWhenSettingTrueThenFlagTrueReturned) {
|
|
|
|
OsContext *osContext = OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
|
|
|
|
EXPECT_FALSE(osContext->isDefaultContext());
|
|
|
|
osContext->setDefaultContext(true);
|
|
|
|
EXPECT_TRUE(osContext->isDefaultContext());
|
|
|
|
delete osContext;
|
|
|
|
}
|