-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Atari 8-bit] initial compile / no-compile tests (#286)
* [atari8'] initial tests * refactor tests to add add_compile_test "compile only" test can be used for targets where we don't have a working emulator or test framework but want to check for possible regressions in the SDK * [atari8'] add compile tests * [atari8'] remove unnecessary __attribute__((used))
- Loading branch information
Showing
17 changed files
with
176 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.18) | ||
|
||
project(test-atari8-dos LANGUAGES C) | ||
|
||
include(../test.cmake) | ||
|
||
add_subdirectory(compile) | ||
add_subdirectory(no-compile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL ON) | ||
|
||
add_compile_test(minimal) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
#include <stdio.h> | ||
|
||
int main(void) { | ||
printf("hello\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL ON) | ||
|
||
add_no_compile_test(ram-too-big) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// ExpectFailure: ld.lld: error: section '.data' will not fit in region 'ram' | ||
|
||
#include <stdint.h> | ||
|
||
// atari8-dos; presently we have 40KiB of RAM from 0x2000 to 0xC000, | ||
// array sizes have to be <=32767; use 30+10 | ||
uint8_t ram_too_big0[30 * 1024] = { 0x55 }; | ||
uint8_t ram_too_big1[10 * 1024] = { 0xAA }; | ||
|
||
int main(void) { | ||
asm volatile( | ||
"" | ||
: | ||
: "r"(ram_too_big0) | ||
: | ||
); | ||
asm volatile( | ||
"" | ||
: | ||
: "r"(ram_too_big1) | ||
: | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.18) | ||
|
||
project(test-atari8-stdcart LANGUAGES C) | ||
|
||
include(../test.cmake) | ||
|
||
add_subdirectory(compile) | ||
add_subdirectory(no-compile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL ON) | ||
|
||
add_compile_test(minimal) | ||
add_compile_test(cart-rom-8-fit-6) | ||
add_compile_test(cart-rom-16-fit-14) | ||
add_compile_test(cart-rom-size-declared) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
#include <stdint.h> | ||
|
||
asm(".globl __cart_rom_size \n __cart_rom_size = 16"); | ||
|
||
// atari8-stdcard, 16 KiB | ||
uint8_t data_too_big[14 * 1024] = { 0x55 }; | ||
|
||
int main(void) { | ||
asm volatile( | ||
"" | ||
: | ||
: "r"(data_too_big) | ||
: | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
#include <stdint.h> | ||
|
||
asm(".globl __cart_rom_size \n __cart_rom_size = 8"); | ||
|
||
// atari8-stdcard, 8 KiB | ||
uint8_t data_too_big[6 * 1024] = { 0x55 }; | ||
|
||
int main(void) { | ||
asm volatile( | ||
"" | ||
: | ||
: "r"(data_too_big) | ||
: | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
#include <stdint.h> | ||
|
||
extern int __cart_rom_size; | ||
|
||
int main(void) { | ||
asm volatile( | ||
"" | ||
: | ||
: "r"(__cart_rom_size) | ||
: | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
#include <stdio.h> | ||
|
||
int main(void) { | ||
printf("hello\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL ON) | ||
|
||
add_no_compile_test(ram-too-big) | ||
add_no_compile_test(cart-rom-8-too-big) | ||
add_no_compile_test(cart-rom-16-too-big) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// ExpectFailure: ld.lld: error: section '.data' will not fit in region 'cart_rom': overflowed | ||
|
||
#include <stdint.h> | ||
|
||
asm(".globl __cart_rom_size \n __cart_rom_size = 16"); | ||
|
||
// atari8-stdcard, 16 KiB, this won't fit | ||
uint8_t data_too_big[16 * 1024] = { 0x55 }; | ||
|
||
int main(void) { | ||
asm volatile( | ||
"" | ||
: | ||
: "r"(data_too_big) | ||
: | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// ExpectFailure: ld.lld: error: section '.data' will not fit in region 'cart_rom': overflowed | ||
|
||
#include <stdint.h> | ||
|
||
asm(".globl __cart_rom_size \n __cart_rom_size = 8"); | ||
|
||
// atari8-stdcard, 8 KiB, this won't fit | ||
uint8_t data_too_big[8 * 1024] = { 0x55 }; | ||
|
||
int main(void) { | ||
asm volatile( | ||
"" | ||
: | ||
: "r"(data_too_big) | ||
: | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// ExpectFailure: ld.lld: error: section '.bss' will not fit in region 'ram': overflowed | ||
|
||
#include <stdint.h> | ||
|
||
// atari8-stdcart; we have 14.25 KiB of RAM from 0x700 to 0x4000 | ||
uint8_t ram_too_big[15 * 1024]; | ||
|
||
int main(void) { | ||
asm volatile( | ||
"" | ||
: | ||
: "r"(ram_too_big) | ||
: | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters