Skip to content

Commit

Permalink
[basm] Add some missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Krusty/Benediction committed Jul 11, 2024
1 parent 9c0b0e0 commit c84961b
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 0 deletions.
24 changes: 24 additions & 0 deletions cpclib-basm/pgo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

set -e


PROGRAM="basm"

# STEP 0: Make sure there is no left-over profiling data from previous runs
rm -rf /tmp/pgo-data || true

# STEP 1: Build the instrumented binaries
RUSTFLAGS="-Cprofile-generate=/tmp/pgo-data" \
cargo build --release

# STEP 2: Run the instrumented binaries with some typical data
../target/release/$PROGRAM ../../z80_assemblers_benchmark/z80/include_files.asm > /dev/null
../target/release/$PROGRAM ./tests/asm/roudoudou/rasm_sprites.asm > /dev/null

# STEP 3: Merge the `.profraw` files into a `.profdata` file
llvm-profdata merge -o /tmp/pgo-data/merged.profdata /tmp/pgo-data

# STEP 4: Use the `.profdata` file for guiding optimizations
RUSTFLAGS="-Cprofile-use=/tmp/pgo-data/merged.profdata" \
cargo build --release
8 changes: 8 additions & 0 deletions cpclib-basm/tests/asm/disc/save_hfe.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
org 0x4000
BINARY_START
run $
ld a, 'A' : call 0xbb5a
jp $
BINARY_STOP

save "test", BINARY_START, BINARY_STOP-BINARY_START, HFE, "saved.hfe"
Binary file added cpclib-basm/tests/asm/disc/saved.hfe
Binary file not shown.
Binary file added cpclib-basm/tests/asm/rasm_comparison/basm.sna
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added cpclib-basm/tests/asm/rasm_comparison/rasm.dsk
Binary file not shown.
Binary file added cpclib-basm/tests/asm/rasm_comparison/rasm.sna
Binary file not shown.
Binary file not shown.
8 changes: 8 additions & 0 deletions cpclib-basm/tests/asm/rasm_comparison/save_dsk.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

org 0x4000
BINARY_START
run $
jp $
BINARY_STOP

save "test", BINARY_START, BINARY_STOP-BINARY_START, DSK, "saved.dsk"
16 changes: 16 additions & 0 deletions cpclib-basm/tests/asm/rasm_comparison/save_sna.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
; cargo run -- save_sna.asm --nochunk BRKS --sna -o basm.sna
; to be compared with
; rasm -sb -ss save_sna.asm -o rasm


BUILDSNA
BANKSET 0

org 0x1234
BINARY_START
run $
START
BREAKPOINT
jp $
BREAKPOINT
BINARY_STOP
Binary file added cpclib-basm/tests/asm/rasm_comparison/saved.hfe
Binary file not shown.

0 comments on commit c84961b

Please sign in to comment.