Skip to content

Commit ebd5e38

Browse files
committed
PR 117: assert achievements=true, cache rcheevos E2E, clarify CLAUDE.md
- test_memory_map: capture SET_SUPPORT_ACHIEVEMENTS data per libretro.h (non-NULL bool, true). - CI: actions/cache for build/rcheevos-static keyed by pin + OS + compiler + target. - CLAUDE.md: distinguish no RA server vs GitHub tarball fetch. Made-with: Cursor
1 parent 27c9b04 commit ebd5e38

3 files changed

Lines changed: 35 additions & 9 deletions

File tree

.github/workflows/c-cpp.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,13 @@ jobs:
211211
$CC -O2 -Wall -o test/tools/test_memory_map test/tools/test_memory_map.c $LDFLAGS
212212
./test/tools/test_memory_map ./${{ matrix.config.artifact }}
213213
214+
- name: Cache pinned rcheevos E2E build
215+
if: ${{ !matrix.config.emscripten && !matrix.config.android && !matrix.config.cross && runner.os != 'Windows' }}
216+
uses: actions/cache@v4
217+
with:
218+
path: build/rcheevos-static
219+
key: rcheevos-e2e-fd57e900-${{ runner.os }}-${{ matrix.config.cc }}-${{ matrix.config.displayTargetName }}
220+
214221
- name: RetroAchievements rc_libretro E2E test
215222
if: ${{ !matrix.config.emscripten && !matrix.config.android && !matrix.config.cross && runner.os != 'Windows' }}
216223
env:

CLAUDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ Key docs:
9292

9393
### Testing
9494

95-
RetroAchievements-related (no RetroAchievements server/API access; local validation only):
95+
RetroAchievements-related **no RetroAchievements account, API, or gameplay server**; local validation only. The E2E harness still **fetches the pinned rcheevos source tarball from GitHub** when `build/rcheevos-static` is missing (CI may cache that directory); that is unrelated to contacting RetroAchievements services.
9696

97-
- `test/tools/test_memory_map.c` — asserts `SET_MEMORY_MAPS` / `SET_SUPPORT_ACHIEVEMENTS` and descriptor layout vs `retro_get_memory_data(SYSTEM_RAM)`.
98-
- `test/tools/test_rcheevos_e2e.sh`does not contact RetroAchievements services; it downloads pinned **rcheevos** (`RCHEEVOS_REF`, default `v12.3.0`) when needed in a clean environment, builds `librcheevos.a`, then runs `test_rcheevos_e2e` to verify **rc_libretro** memory resolution (`RC_CONSOLE_ATARI_JAGUAR`) matches host RAM — the same mapping stack RetroArch uses before any RA API call. If the pinned tarball/build output is already cached locally, this external download step is avoided.
97+
- `test/tools/test_memory_map.c` — asserts `SET_MEMORY_MAPS`, `SET_SUPPORT_ACHIEVEMENTS` with **`true`**, and descriptor layout vs `retro_get_memory_data(SYSTEM_RAM)`.
98+
- `test/tools/test_rcheevos_e2e.sh` — downloads pinned **rcheevos** (`RCHEEVOS_REF`) when needed, builds `librcheevos.a`, then runs `test_rcheevos_e2e` to verify **rc_libretro** memory resolution (`RC_CONSOLE_ATARI_JAGUAR`) matches host RAM — the same mapping stack RetroArch uses before any RA cloud call.
9999

100100
See `docs/test-infrastructure.md` for all test harnesses:
101101
- `test/test_dsp_mac40.c` — Jaguar DSP **40-bit MAC** accumulator semantics (`dsp_acc40.h`), run in CI with SIMD tests; relevant for long IIR chains (e.g. pink-noise generators on DSP).

test/tools/test_memory_map.c

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* test_memory_map.c — Verify RetroAchievements memory map advertisement.
33
*
44
* Loads the core, feeds a minimal dummy ROM, and checks that
5-
* RETRO_ENVIRONMENT_SET_MEMORY_MAPS and SET_SUPPORT_ACHIEVEMENTS
6-
* are called with correct values.
5+
* RETRO_ENVIRONMENT_SET_MEMORY_MAPS is advertised and SET_SUPPORT_ACHIEVEMENTS
6+
* is called with a non-NULL pointer to bool true (per libretro.h).
77
*
88
* Build:
99
* cc -o test/tools/test_memory_map test/tools/test_memory_map.c -ldl (Linux)
@@ -44,6 +44,8 @@ typedef size_t (*retro_get_memory_size_t)(unsigned);
4444

4545
static bool got_memory_maps;
4646
static bool got_achievements;
47+
static bool achievements_data_ok;
48+
static bool achievements_enabled_true;
4749
static const struct retro_memory_map *captured_memmap;
4850

4951
static bool env_cb(unsigned cmd, void *data)
@@ -56,6 +58,11 @@ static bool env_cb(unsigned cmd, void *data)
5658
return true;
5759
case RETRO_ENVIRONMENT_SET_SUPPORT_ACHIEVEMENTS:
5860
got_achievements = true;
61+
if (data)
62+
{
63+
achievements_data_ok = true;
64+
achievements_enabled_true = *(const bool *)data;
65+
}
5966
return true;
6067
case RETRO_ENVIRONMENT_SET_PIXEL_FORMAT:
6168
case RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME:
@@ -168,6 +175,8 @@ int main(int argc, char **argv)
168175

169176
got_memory_maps = false;
170177
got_achievements = false;
178+
achievements_data_ok = false;
179+
achievements_enabled_true = false;
171180
captured_memmap = NULL;
172181

173182
core_set_env(env_cb);
@@ -178,15 +187,25 @@ int main(int argc, char **argv)
178187
core_set_input_state(input_state);
179188
core_init();
180189

181-
/* Test 1: SET_SUPPORT_ACHIEVEMENTS called during retro_set_environment */
182-
printf("Test 1: SET_SUPPORT_ACHIEVEMENTS ... ");
183-
if (got_achievements)
190+
/* Test 1: SET_SUPPORT_ACHIEVEMENTS during retro_set_environment — non-NULL bool, true */
191+
printf("Test 1: SET_SUPPORT_ACHIEVEMENTS (true) ... ");
192+
if (got_achievements && achievements_data_ok && achievements_enabled_true)
184193
printf("PASS\n");
185-
else
194+
else if (!got_achievements)
186195
{
187196
printf("FAIL (not called)\n");
188197
failures++;
189198
}
199+
else if (!achievements_data_ok)
200+
{
201+
printf("FAIL (NULL data)\n");
202+
failures++;
203+
}
204+
else
205+
{
206+
printf("FAIL (expected true, got false)\n");
207+
failures++;
208+
}
190209

191210
/* Load the dummy ROM to trigger SET_MEMORY_MAPS */
192211
rom = make_dummy_rom(&rom_size);

0 commit comments

Comments
 (0)