Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues when building tests with agbcc #4689

Merged
merged 2 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,13 @@ ELF = $(ROM:.gba=.elf)
MAP = $(ROM:.gba=.map)
SYM = $(ROM:.gba=.sym)

TEST_OBJ_DIR_NAME_MODERN := build/modern-test
TEST_OBJ_DIR_NAME_AGBCC := build/test

ifeq ($(MODERN),0)
TEST_OBJ_DIR_NAME := build/test
TEST_OBJ_DIR_NAME := $(TEST_OBJ_DIR_NAME_AGBCC)
else
TEST_OBJ_DIR_NAME := build/modern-test
TEST_OBJ_DIR_NAME := $(TEST_OBJ_DIR_NAME_MODERN)
endif
TESTELF = $(ROM:.gba=-test.elf)
HEADLESSELF = $(ROM:.gba=-test-headless.elf)
Expand Down Expand Up @@ -309,7 +312,9 @@ tidymodern:

tidycheck:
rm -f $(TESTELF) $(HEADLESSELF)
rm -rf $(TEST_OBJ_DIR_NAME)
rm -rf $(TEST_OBJ_DIR_NAME_MODERN)
rm -rf $(TEST_OBJ_DIR_NAME_AGBCC)


ifneq ($(MODERN),0)
$(C_BUILDDIR)/berry_crush.o: override CFLAGS += -Wno-address-of-packed-member
Expand Down
15 changes: 11 additions & 4 deletions test/species.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ TEST("Form species ID tables are shared between all forms")
{
u32 i;
u32 species = SPECIES_NONE;
const u16 *formSpeciesIdTable;

for (i = 0; i < NUM_SPECIES; i++)
{
if (gSpeciesInfo[i].formSpeciesIdTable) PARAMETRIZE { species = i; }
}

const u16 *formSpeciesIdTable = gSpeciesInfo[species].formSpeciesIdTable;
formSpeciesIdTable = gSpeciesInfo[species].formSpeciesIdTable;
for (i = 0; formSpeciesIdTable[i] != FORM_SPECIES_END; i++)
{
u32 formSpeciesId = formSpeciesIdTable[i];
Expand All @@ -23,13 +25,16 @@ TEST("Form change tables contain only forms in the form species ID table")
{
u32 i, j;
u32 species = SPECIES_NONE;
const struct FormChange *formChangeTable;
const u16 *formSpeciesIdTable;

for (i = 0; i < NUM_SPECIES; i++)
{
if (gSpeciesInfo[i].formChangeTable) PARAMETRIZE { species = i; }
}

const struct FormChange *formChangeTable = gSpeciesInfo[species].formChangeTable;
const u16 *formSpeciesIdTable = gSpeciesInfo[species].formSpeciesIdTable;
formChangeTable = gSpeciesInfo[species].formChangeTable;
formSpeciesIdTable = gSpeciesInfo[species].formSpeciesIdTable;
EXPECT(formSpeciesIdTable);

for (i = 0; formChangeTable[i].method != FORM_CHANGE_TERMINATOR; i++)
Expand All @@ -51,12 +56,14 @@ TEST("Form change targets have the appropriate species flags")
{
u32 i;
u32 species = SPECIES_NONE;
const struct FormChange *formChangeTable;

for (i = 0; i < NUM_SPECIES; i++)
{
if (gSpeciesInfo[i].formChangeTable) PARAMETRIZE { species = i; }
}

const struct FormChange *formChangeTable = gSpeciesInfo[species].formChangeTable;
formChangeTable = gSpeciesInfo[species].formChangeTable;
for (i = 0; formChangeTable[i].method != FORM_CHANGE_TERMINATOR; i++)
{
const struct SpeciesInfo *targetSpeciesInfo = &gSpeciesInfo[formChangeTable[i].targetSpecies];
Expand Down
4 changes: 4 additions & 0 deletions test/test_runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,11 @@ static s32 MgbaVPrintf_(const char *fmt, va_list va)
/* Entry point for the Debugging and Control System. Handles illegal
* instructions, which are typically caused by branching to an invalid
* address. */
#if MODERN
__attribute__((naked, section(".dacs"), target("arm")))
#else
__attribute__((naked, section(".dacs")))
#endif
void DACSEntry(void)
{
asm(".arm\n\
Expand Down
Loading