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

Add tests #7

Merged
merged 36 commits into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
633f5b9
git subrepo pull (merge) libgfxd
Dragorn421 Dec 20, 2022
9f0d064
Fix https://github.com/Thar0/pygfxd/issues/5
Dragorn421 Dec 18, 2022
6066f7a
Fix/update `gfx_ucode` structure in py binding
Dragorn421 Dec 19, 2022
afb8dfa
Update python bindings to libgfxd 7dd7fa1
Dragorn421 Dec 18, 2022
b5e08a0
Some test setup
Dragorn421 Dec 18, 2022
04f51ee
remove test.py, shebang gang
Dragorn421 Dec 19, 2022
d796607
Introduce unittest usage
Dragorn421 Dec 20, 2022
b2620c1
Add CROSS as binutils prefix
Dragorn421 Dec 20, 2022
905c7fc
Add `test_gfxd_vtx_callback`
Dragorn421 Dec 20, 2022
c480e12
fix unsetting buf/cb (wip), rework anti-gc buf/cb dict, fix https://g…
Dragorn421 Dec 23, 2022
a153459
Merge branch 'master' into dev
Dragorn421 Dec 23, 2022
2fc6146
Fix somehow removed actual call to output_buffer
Dragorn421 Dec 23, 2022
e58393b
Merge branch 'master' into dev
Dragorn421 Dec 23, 2022
d4e4c94
Fix: replace del with .pop(..., None) to fix KeyError if no callback …
Dragorn421 Dec 23, 2022
c600fbe
Merge branch 'master' into dev
Dragorn421 Dec 23, 2022
31026e3
Fix `gfxd_arg_value`, `gfxd_value_by_type` bindings
Dragorn421 Dec 24, 2022
4df2c33
Merge branch 'master' into dev
Dragorn421 Dec 24, 2022
8cc4876
more tests
Dragorn421 Dec 24, 2022
9167d4c
fix
Dragorn421 Dec 24, 2022
7ac147e
Have gfxd_vtx_callback binding take None
Dragorn421 Dec 24, 2022
359d3e7
Merge branch 'master' into dev
Dragorn421 Dec 24, 2022
3791ea9
test nulling "missing" callback
Dragorn421 Dec 24, 2022
065541d
fix
Dragorn421 Dec 24, 2022
1508695
Merge branch 'master' into dev
Dragorn421 Dec 24, 2022
4187a3b
Merge remote-tracking branch 'upstream/master' into dev
Dragorn421 Feb 8, 2025
7c55e08
Merge remote-tracking branch 'upstream/master' into dev
Dragorn421 Feb 8, 2025
842028f
revert pygfxd.py
Dragorn421 Feb 8, 2025
5859756
make CI run tests, attempt 1
Dragorn421 Feb 8, 2025
732f2f1
run tests in CI, attempt 2
Dragorn421 Feb 8, 2025
204a19c
run tests in CI, attempt 3
Dragorn421 Feb 8, 2025
dcf76fa
run tests in CI, attempt 4
Dragorn421 Feb 8, 2025
2ee7c00
run tests in CI, attempt 5
Dragorn421 Feb 8, 2025
0338c7b
Fix unsetting callbacks: pass None
Dragorn421 Feb 8, 2025
32a5ccf
Merge branch 'fix_unsetting_callbacks' into dev
Dragorn421 Feb 8, 2025
a4299bf
fix fix
Dragorn421 Feb 8, 2025
bbcd94b
Merge remote-tracking branch 'upstream/master' into dev
Dragorn421 Feb 9, 2025
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
23 changes: 23 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Run tests

# Build on every branch push, tag push, and pull request change:
on: [push, pull_request]

jobs:
run_tests:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Compile libgfxd
run: gcc -shared -fPIC libgfxd/gfxd.c libgfxd/uc_f3d.c libgfxd/uc_f3db.c libgfxd/uc_f3dex.c libgfxd/uc_f3dex2.c libgfxd/uc_f3dexb.c libgfxd/uc.c -o libgfxd.so

- name: Install cross compiler and binutils
run: sudo apt-get install gcc-mips-linux-gnu binutils-mips-linux-gnu

- name: Build test data
run: make -C test

- name: Run tests
run: ./test/test.py
48 changes: 0 additions & 48 deletions test.py

This file was deleted.

3 changes: 3 additions & 0 deletions test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.o
*.bin
*.txt
24 changes: 24 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Compile C files and dump their .data section to binary

CROSS := mips-linux-gnu-

CC := $(CROSS)gcc
OBJCOPY := $(CROSS)objcopy
NM := $(CROSS)nm

C_FILES := f3dex2.c
BIN_FILES := $(C_FILES:.c=.bin)

bin_files: $(BIN_FILES)

test: bin_files
./test.py

.PHONY: bin_files test

%.bin: %.o
$(OBJCOPY) -O binary -j .data $< $@
$(NM) -f sysv $< > $(@:.bin=.txt)

%.o: %.c
$(CC) -c -o $@ $^
16 changes: 16 additions & 0 deletions test/f3dex2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#define F3DEX_GBI_2
#include "gbi.h"

Gfx emptyDList[] = {
gsSPEndDisplayList(),
};

Gfx oneTriDList[] = {
gsSPVertex(0x42042069, 3, 0),
gsSP1Triangle(0, 1, 2, 0),
gsSPEndDisplayList(),
};

Gfx setLights1DList[] = {
gsSPSetLights1(*(Lightsn *)0x09000000),
};
1 change: 1 addition & 0 deletions test/gbi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "../libgfxd/gbi.h"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could an include path for libgfxd be specified in the makefile rather than this dummy file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea with this wrapper .h would also be to let someone try another gbi.h, since libgfxd's is glank's i.e. not sgi's / decomp's

But yeah this can be changed idk

Loading
Loading