mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-09 22:56:35 +00:00
hos: allow turning off ams extension hard-reqs for unit testing
This commit is contained in:
parent
2a842791eb
commit
018ae08409
5 changed files with 42 additions and 1 deletions
|
@ -123,6 +123,7 @@ $(OFILES) : $(GCH_FILES)
|
|||
$(OFILES_SRC) : $(HFILES_BIN)
|
||||
|
||||
ams_environment_weak.o: CXXFLAGS += -fno-lto
|
||||
hos_version_api_weak_for_unit_test.o: CXXFLAGS += -fno-lto
|
||||
pm_info_api_weak.o: CXXFLAGS += -fno-lto
|
||||
hos_stratosphere_api.o: CXXFLAGS += -fno-lto
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ namespace ams::hos {
|
|||
|
||||
}
|
||||
|
||||
bool IsUnitTestProgramForSetVersion();
|
||||
void InitializeVersionInternal(bool allow_approximate);
|
||||
|
||||
void InitializeForStratosphere() {
|
||||
|
@ -58,7 +59,7 @@ namespace ams::hos {
|
|||
hos::InitializeVersionInternal(CanAllowTemporaryApproximateVersion());
|
||||
|
||||
/* Check that we're running under mesosphere. */
|
||||
AMS_ABORT_UNLESS(svc::IsKernelMesosphere());
|
||||
AMS_ABORT_UNLESS(IsUnitTestProgramForSetVersion() || svc::IsKernelMesosphere());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -61,7 +61,16 @@ namespace ams::hos {
|
|||
|
||||
}
|
||||
|
||||
bool IsUnitTestProgramForSetVersion();
|
||||
|
||||
void InitializeVersionInternal(bool allow_approximate) {
|
||||
/* If we're unit testing, just set the version and move on. */
|
||||
if (IsUnitTestProgramForSetVersion()) {
|
||||
g_hos_version = hos::Version_Current;
|
||||
g_set_hos_version = true;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get the current (and previous approximation of) target firmware. */
|
||||
hos::Version prev, current;
|
||||
bool has_prev = false;
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright (c) Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <stratosphere.hpp>
|
||||
|
||||
namespace ams::hos {
|
||||
|
||||
WEAK_SYMBOL bool IsUnitTestProgramForSetVersion() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -27,6 +27,12 @@ namespace ams {
|
|||
|
||||
}
|
||||
|
||||
namespace hos {
|
||||
|
||||
bool IsUnitTestProgramForSetVersion() { return true; }
|
||||
|
||||
}
|
||||
|
||||
namespace init {
|
||||
|
||||
void InitializeSystemModuleBeforeConstructors() {
|
||||
|
|
Loading…
Reference in a new issue