refactor (test): moved from kernel repository

This commit is contained in:
antifallobst 2023-06-01 00:05:52 +02:00
parent acd1042090
commit 1f85d26779
4 changed files with 59 additions and 106 deletions

107
.gitignore vendored
View File

@ -1,106 +1 @@
# ---> C
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
# ---> CMake
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
# ---> Go
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
# Go workspace file
go.work
# ---> Rust
# Generated by Cargo
# will have compiled files and executables
debug/
target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt
**/*.rs.bk
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
build

3
test/README.md Normal file
View File

@ -0,0 +1,3 @@
# Test driver
This is a test driver, to test driver loading and the API.

48
test/build.sh Executable file
View File

@ -0,0 +1,48 @@
#!/usr/bin/bash
# This file is part of noxos and licensed under the MIT open source license
NX_DRV_NAME="test"
set -e
workspace_setup() {
echo " --> Setting up workspace"
mkdir -pv ../build
echo ""
}
check_toolchain() {
echo " --> Checking Toolchain"
hash gcc
echo " |--> found gcc"
hash ld
echo " |--> found ld"
[ ! -f "../../libraries/libnxdrv/build/libnxdrv.so" ] && echo "libnxdrv not found!" && exit 255
echo " |--> found libnxdrv"
echo " --> All checks passed"
}
driver_build() {
echo " --> Building driver: $NX_DRV_NAME"
gcc src/main.c -o ../build/$NX_DRV_NAME.nxkm -nostdlib -nolibc -I../../libraries/libnxdrv/inc -L../../libraries/libnxdrv/build -lnxdrv
echo ""
}
echo "!=====[ libnx build script ]=====!"
case $1 in
"check")
check_toolchain
;;
*)
workspace_setup
driver_build
;;
esac
echo "!=====[ Finished ]=====!"

7
test/src/main.c Normal file
View File

@ -0,0 +1,7 @@
#include "libnxdrv.h"
int _start() {
nx_drv_init();
return 0;
}