2019-12-19 14:02:05 +01:00
|
|
|
/*
|
2020-01-13 14:47:05 +01:00
|
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
2019-12-19 14:02:05 +01:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/os_interface/os_context.h"
|
2019-12-19 14:02:05 +01:00
|
|
|
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
|
|
|
using namespace NEO;
|
|
|
|
|
|
|
|
TEST(OSContext, whenCreatingDefaultOsContextThenExpectInitializedAlways) {
|
2020-03-03 23:33:31 +01:00
|
|
|
OsContext *osContext = OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
|
2019-12-19 14:02:05 +01:00
|
|
|
EXPECT_TRUE(osContext->isInitialized());
|
2020-03-03 23:33:31 +01: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 14:02:05 +01:00
|
|
|
delete osContext;
|
|
|
|
}
|
2020-03-06 19:02:24 +01: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;
|
|
|
|
}
|