b9874d0941
Add redbear-usb-storage-check in-guest binary that validates USB mass storage read and write I/O: discovers /scheme/disk/ devices, writes a test pattern to sector 2048, reads it back, verifies match, restores original content. Updates test-usb-storage-qemu.sh with write-proof verification step. Includes all accumulated Red Bear OS work: kernel patches, relibc patches, driver infrastructure, DRM/GPU, KDE recipes, firmware, validation tooling, build system hardening, and documentation.
51 lines
1.3 KiB
C
51 lines
1.3 KiB
C
// These tests are primarily to ensure the macros compile without
|
|
// causing any funny business.
|
|
// TODO: does not compile with glibc
|
|
|
|
#include <features.h>
|
|
#include <stdio.h>
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
|
|
#ifndef __GLIBC__
|
|
__deprecated
|
|
#endif
|
|
static void legacy(void) {}
|
|
|
|
#ifndef __GLIBC__
|
|
__deprecatedNote("Sometimes deletes user's home (oops); use foobar")
|
|
#endif
|
|
static void legacy_notes(void) {}
|
|
|
|
#ifndef __GLIBC__
|
|
__nodiscard
|
|
#endif
|
|
static uint8_t the_answer(void) {
|
|
return 42;
|
|
}
|
|
|
|
// GCC bug
|
|
/* #pragma GCC diagnostic push */
|
|
/* #pragma GCC diagnostic ignored "-Wattributes" */
|
|
/* __noreturn */
|
|
/* static void foobar(void) { */
|
|
// The test suite isn't picking up noreturn in the headers for exit, abort
|
|
// Those functions (and this test) works fine in both Redox itself and Linux
|
|
// Using _Exit instead works for the tests in CI. Why? I dunno.
|
|
/* _Exit(0); */
|
|
/* } */
|
|
/* #pragma GCC diagnostic pop */
|
|
|
|
int main(void) {
|
|
#pragma GCC diagnostic push
|
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
legacy();
|
|
legacy_notes();
|
|
#pragma GCC diagnostic pop
|
|
const int answer = the_answer();
|
|
char buf[40] = {0};
|
|
sprintf(buf, "Hey, -Werror, I'm using answer: %d\n", answer);
|
|
/* foobar(); */
|
|
return 0;
|
|
}
|