Skip to content

Commit cdbc0a9

Browse files
SiegeLordExSiegeLord
authored andcommitted
Allow marking tests as being hardware only.
Annotate the relevant tests. Fixes #626 Fixes #627
1 parent f947d6d commit cdbc0a9

File tree

4 files changed

+33
-14
lines changed

4 files changed

+33
-14
lines changed

tests/test_compressed.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
# All of these are hardware only as compressed bitmaps are a video-bitmap only feature.
2+
13
[loading]
4+
hw_only = true
25
op0=b = al_load_bitmap(filename)
36
op1=al_draw_bitmap(b, 0, 0, 0)
47

@@ -18,6 +21,7 @@ filename = ../examples/data/mysha_dxt5.dds
1821
sig=ftZE50000um0050000jLL050000222200000000000000000000000000000000000000000000000000
1922

2023
[dest rw]
24+
hw_only = true
2125
op0=b = al_load_bitmap(filename)
2226
op1=al_set_target_bitmap(b)
2327
# Need to lock, otherwise the triangles of the rectangle will lock separately and result in diagonal artifacts
@@ -43,6 +47,7 @@ filename = ../examples/data/mysha_dxt5.dds
4347
sig=ggZE50000gg0050000jLL050000222200000000000000000000000000000000000000000000000000
4448

4549
[dest wo]
50+
hw_only = true
4651
filename2 = ../examples/data/blue_box.png
4752
op0=b = al_load_bitmap(filename)
4853
op1=b2 = al_load_bitmap(filename2)
@@ -67,6 +72,7 @@ filename = ../examples/data/mysha_dxt5.dds
6772
sig=OOZD50000OO0050000aML050000222200000000000000000000000000000000000000000000000000
6873

6974
[src]
75+
hw_only = true
7076
filename2 = ../examples/data/fakeamp.bmp
7177
op0=b = al_load_bitmap(filename)
7278
op1=b2 = al_load_bitmap(filename2)
@@ -93,6 +99,7 @@ filename = ../examples/data/mysha_dxt5.dds
9399
sig=ftwu00000um0w00000QB0r00000vrnv00000000000000000000000000000000000000000000000000
94100

95101
[dest sub]
102+
hw_only = true
96103
op0=b = al_load_bitmap(filename)
97104
op1=b2 = al_create_sub_bitmap(b, 16, 16, 128, 128);
98105
op2=al_set_target_bitmap(b2)
@@ -116,6 +123,7 @@ filename = ../examples/data/mysha_dxt5.dds
116123
sig=LLZD50000LL0050000ZLL050000222200000000000000000000000000000000000000000000000000
117124

118125
[convert from]
126+
hw_only = true
119127
op0=b = al_load_bitmap(filename)
120128
op1=al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_RGB_565)
121129
op2=al_convert_bitmap(b)
@@ -137,6 +145,7 @@ filename = ../examples/data/mysha_dxt5.dds
137145
sig=ftZD50000um0050000jLL050000222200000000000000000000000000000000000000000000000000
138146

139147
[convert to]
148+
hw_only = true
140149
filename = ../examples/data/blue_box.png
141150
op0=al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_RGB_565)
142151
op1=b = al_load_bitmap(filename)

tests/test_convert.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
[test convert]
2+
# This test relies on needing a video bitmap.
3+
hw_only = true
24
op0= al_clear_to_color(#554321)
35
op1= al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP)
46
op2= al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_RGB_565)

tests/test_driver.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ int verbose = 0;
7070
int total_tests = 0;
7171
int passed_tests = 0;
7272
int failed_tests = 0;
73+
int skipped_tests = 0;
7374

7475
#define streq(a, b) (0 == strcmp((a), (b)))
7576

@@ -932,7 +933,7 @@ static void check_similarity(ALLEGRO_CONFIG const *cfg,
932933
}
933934

934935
static void do_test(ALLEGRO_CONFIG *cfg, char const *testname,
935-
ALLEGRO_BITMAP *target, int bmp_type, bool reliable)
936+
ALLEGRO_BITMAP *target, int bmp_type, bool reliable, bool do_check_hash)
936937
{
937938
#define MAXBUF 80
938939

@@ -1484,12 +1485,10 @@ static void do_test(ALLEGRO_CONFIG *cfg, char const *testname,
14841485

14851486
al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA);
14861487

1487-
if (bmp_type == SW) {
1488-
al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP);
1488+
if (do_check_hash) {
14891489
check_hash(cfg, testname, target, bmp_type);
14901490
}
14911491
else {
1492-
al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP);
14931492
check_similarity(cfg, testname, target, membuf, bmp_type, reliable);
14941493
}
14951494

@@ -1538,15 +1537,23 @@ static void sw_hw_test(ALLEGRO_CONFIG *cfg, char const *testname)
15381537
{
15391538
int old_failed_tests = failed_tests;
15401539
bool reliable;
1540+
char const *hw_only_str = al_get_config_value(cfg, testname, "hw_only");
1541+
bool hw_only = hw_only_str && get_bool(hw_only_str);
15411542

15421543
al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP);
1543-
do_test(cfg, testname, membuf, SW, true);
1544+
if (!hw_only) {
1545+
do_test(cfg, testname, membuf, SW, true, true);
1546+
}
15441547

15451548
reliable = (failed_tests == old_failed_tests);
15461549

15471550
if (display) {
15481551
al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP);
1549-
do_test(cfg, testname, al_get_backbuffer(display), HW, reliable);
1552+
do_test(cfg, testname, al_get_backbuffer(display), HW, reliable, hw_only);
1553+
} else if (hw_only) {
1554+
printf("WARNING: Skipping hardware-only test due to the --no-display flag: %s\n",
1555+
testname);
1556+
skipped_tests++;
15501557
}
15511558
}
15521559

@@ -1811,6 +1818,7 @@ int main(int _argc, char *_argv[])
18111818
printf("total tests: %d\n", total_tests);
18121819
printf("passed tests: %d\n", passed_tests);
18131820
printf("failed tests: %d\n", failed_tests);
1821+
printf("skipped tests: %d\n", skipped_tests);
18141822
printf("\n");
18151823

18161824
return !!failed_tests;

tests/test_prim2.ini

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
# Test primitives which are only in the 5.1 branch.
22

33
[test projection]
4+
# Projection doesn't work on memory bitmaps
5+
hw_only = true
46
op0=al_orthographic_transform(trans, -1, -1, -1, 1, 1, 1)
57
op1=al_use_projection_transform(trans)
68
op2=al_draw_filled_circle(0, 0, 1, #aa6600)
7-
# Projection doesn't work on memory bitmaps
8-
hash=35af6375
9-
hash_hw=cb2630a9
10-
sig_hw=0DMMMMMC0CMMMMMMM9MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM9MMMMMMM60AMMMMM80
9+
hash=cb2630a9
10+
sig=0DMMMMMC0CMMMMMMM9MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM9MMMMMMM60AMMMMM80
1111

1212
[test projection flipped]
13+
# Projection doesn't work on memory bitmaps
14+
hw_only = true
1315
op0=al_orthographic_transform(trans, -1, 1, -1, 1, -1, 1)
1416
op1=al_use_projection_transform(trans)
1517
op2=al_draw_filled_circle(0, 0, 1, #aa6600)
16-
# Projection doesn't work on memory bitmaps
17-
hash=35af6375
18-
hash_hw=65feb169
19-
sig_hw=0DMMMMMC0CMMMMMMM9MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM9MMMMMMM60AMMMMM80
18+
hash=cb2630a9
19+
sig=0DMMMMMC0CMMMMMMM9MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM9MMMMMMM60AMMMMM80
2020

2121
[triangle base]
2222
op0=al_clear_to_color(white)

0 commit comments

Comments
 (0)