mirror of
https://github.com/antonblanchard/microwatt.git
synced 2026-05-04 07:19:18 +00:00
Add a new misc test suite with addpcis tests
The two tests obtain NIA with bl+mflr+addi and then compare it against addpcis with the minimum and maximum immediate operand values. They were also tested on a real POWER9 system (in userspace) for good measure. Signed-off-by: Shawn Anastasio <shawn@anastas.io>
This commit is contained in:
44
tests/misc/misc.c
Normal file
44
tests/misc/misc.c
Normal file
@@ -0,0 +1,44 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "console.h"
|
||||
|
||||
#define TEST "Test "
|
||||
#define PASS "PASS\n"
|
||||
#define FAIL "FAIL\n"
|
||||
|
||||
extern long test_addpcis_1(void);
|
||||
extern long test_addpcis_2(void);
|
||||
|
||||
// i < 100
|
||||
void print_test_number(int i)
|
||||
{
|
||||
puts(TEST);
|
||||
putchar(48 + i/10);
|
||||
putchar(48 + i%10);
|
||||
putchar(':');
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int fail = 0;
|
||||
|
||||
potato_uart_init();
|
||||
|
||||
print_test_number(1);
|
||||
if (test_addpcis_1() != 0) {
|
||||
fail = 1;
|
||||
puts(FAIL);
|
||||
} else
|
||||
puts(PASS);
|
||||
|
||||
print_test_number(2);
|
||||
if (test_addpcis_2() != 0) {
|
||||
fail = 1;
|
||||
puts(FAIL);
|
||||
} else
|
||||
puts(PASS);
|
||||
|
||||
return fail;
|
||||
}
|
||||
Reference in New Issue
Block a user