Import a first helper for tests

This commit is contained in:
Pierre Pronchery 2021-10-08 20:57:31 +02:00
parent 6edda6ea24
commit 93639abfdc
5 changed files with 106 additions and 1 deletions

View File

@ -1,5 +1,5 @@
package=Loader
version=0.0.0
subdirs=src,tools
subdirs=src,tests,tools
dist=Makefile,COPYING

View File

@ -0,0 +1,42 @@
/* $Id$ */
/* Copyright (c) 2021 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS System Loader */
/* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* main */
.text
.global main
.type main,@function
main:
/* puts(argv[0]) */
mov (%rsi), %rdi
call puts
/* return 0x42 */
mov $0x42, %rax
ret

View File

@ -0,0 +1 @@
dist=Makefile,printself.S

37
tests/printself.S Normal file
View File

@ -0,0 +1,37 @@
/* $Id$ */
/* Copyright (c) 2021 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS System Loader */
/* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* amd64 */
#if defined(__amd64__)
# include "arch/amd64/printself.S"
#else
# error "Unsupported platform"
#endif

25
tests/project.conf Normal file
View File

@ -0,0 +1,25 @@
subdirs=arch/amd64
targets=printself
as=$(CC)
asflags_force=$(CPPFLAGSF) $(CFLAGSF) -c
asflags=$(CPPFLAGS) $(CFLAGS)
cppflags_force=
cflags_force=-g
cflags=-W -Wall -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
dist=Makefile
mode=amd64-debug
#modes
[mode::amd64-release]
cppflags_force=-DNDEBUG
cflags_force=
[mode::i386-release]
cppflags_force=-DNDEBUG
cflags_force=
#targets
[printself]
type=binary
ldflags=-static
sources=printself.S