Initial commit

This commit is contained in:
alexpete
2021-03-05 11:26:34 -08:00
commit a10351f38d
27091 changed files with 5521199 additions and 0 deletions
@@ -0,0 +1,14 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzTest_Traits_iOS.h>
@@ -0,0 +1,23 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#define AZ_TRAIT_AZTEST_ATTACH_RESULT_LISTENER 0
#define AZ_TRAIT_UNIT_TEST_ASSET_MANAGER_TEST_DEFAULT_TIMEOUT_SECS 5
#define AZ_TRAIT_UNIT_TEST_ENTITY_ID_GEN_TEST_COUNT 10000
#define AZ_TRAIT_UNIT_TEST_DILLER_TRIGGER_EVENT_COUNT 100000
#define AZ_TRAIT_UNIT_TEST_NAME_COUNT 1000
#define AZ_TRAIT_DISABLE_ASSET_JOB_PARALLEL_TESTS true
#define AZ_TRAIT_DISABLE_ASSET_MANAGER_FLOOD_TEST true
#define AZ_TRAIT_DISABLE_ASSETCONTAINERDISABLETEST true
@@ -0,0 +1,157 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <dlfcn.h>
#include <iostream>
#include <AzTest/Platform.h>
#include <unistd.h>
#include <sys/resource.h>
#include <fstream>
class ModuleHandle
: public AZ::Test::IModuleHandle
{
public:
explicit ModuleHandle(const std::string& lib)
: m_libHandle(nullptr)
{
std::string libPath = lib + ".framework/" + lib;
std::cout << "Calling dlopen " << libPath << std::endl;
m_libHandle = dlopen(libPath.c_str(), RTLD_NOW);
const char* err = dlerror();
if (err)
{
std::cerr << "error: " << err << std::endl;
}
}
ModuleHandle(const ModuleHandle&) = delete;
ModuleHandle& operator=(const ModuleHandle&) = delete;
~ModuleHandle() override
{
if (m_libHandle)
{
dlclose(m_libHandle);
}
}
bool IsValid() override { return m_libHandle != nullptr; }
std::shared_ptr<AZ::Test::IFunctionHandle> GetFunction(const std::string& name) override;
private:
friend class FunctionHandle;
void* m_libHandle;
};
//==============================================================================
class FunctionHandle
: public AZ::Test::IFunctionHandle
{
public:
FunctionHandle(ModuleHandle& module, const std::string& symbol)
: m_fn(nullptr)
{
m_fn = dlsym(module.m_libHandle, symbol.c_str());
}
FunctionHandle(const FunctionHandle&) = delete;
FunctionHandle& operator=(const FunctionHandle&) = delete;
~FunctionHandle() override = default;
int operator()(int argc, char** argv) override
{
using Fn = int(int, char**);
Fn* fn = reinterpret_cast<Fn*>(m_fn);
return (*fn)(argc, argv);
}
int operator()() override
{
using Fn = int();
Fn* fn = reinterpret_cast<Fn*>(m_fn);
return (*fn)();
}
bool IsValid() override { return m_fn != nullptr; }
private:
void* m_fn;
};
//==============================================================================
std::shared_ptr<AZ::Test::IFunctionHandle> ModuleHandle::GetFunction(const std::string& name)
{
return std::make_shared<FunctionHandle>(*this, name);
}
//==============================================================================
namespace AZ
{
namespace Test
{
Platform& GetPlatform()
{
static Platform s_platform;
return s_platform;
}
bool Platform::SupportsWaitForDebugger()
{
return false;
}
std::shared_ptr<IModuleHandle> Platform::GetModule(const std::string& lib)
{
return std::make_shared<ModuleHandle>(lib);
}
void Platform::WaitForDebugger()
{
std::cerr << "Platform does not support waiting for debugger." << std::endl;
}
void Platform::SuppressPopupWindows()
{
}
std::string Platform::GetModuleNameFromPath(const std::string& path)
{
size_t start = path.rfind('/');
if (start == std::string::npos)
{
start = 0;
}
size_t end = path.size();
return path.substr(start, end);
}
void Platform::Printf([[maybe_unused]] const char* format, ...)
{
// Not currently supported
}
AZ::EnvironmentInstance Platform::GetTestRunnerEnvironment()
{
return nullptr;
}
} // Test
} // AZ
@@ -0,0 +1,10 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
@@ -0,0 +1,18 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
set(FILES
../Common/UnixLike/AzTest/ColorizedOutput_UnixLike.cpp
${common_dir}/Unimplemented/AzTest/ScopedAutoTempDirectory_Unimplemented.cpp
Platform_iOS.cpp
AzTest_Traits_Platform.h
AzTest_Traits_iOS.h
)