Add test for special case of link stubs when library has noincludes

This is a special case in genmodule. This test purpose is to show this
use case continues working.
This commit is contained in:
deadwood 2024-04-22 15:29:00 +02:00
parent a8d3a4aee8
commit e156fc7832
5 changed files with 108 additions and 1 deletions

View File

@ -0,0 +1,45 @@
/*
Copyright (C) 2024, The AROS Development Team. All rights reserved.
$Id$
*/
#include <proto/exec.h>
#include <proto/dos.h>
#include <CUnit/CUnitCI.h>
CU_SUITE_SETUP()
{
return CUE_SUCCESS;
}
CU_SUITE_TEARDOWN()
{
return CUE_SUCCESS;
}
CU_TEST_SETUP()
{
}
CU_TEST_TEARDOWN()
{
}
void RegSetValue(LONG v);
int StackGetValue();
void test_basic(void)
{
RegSetValue(5);
CU_ASSERT_EQUAL(StackGetValue(), 5);
}
int main(int argc, char** argv)
{
CU_CI_DEFINE_SUITE("Library_Noincludes_Suite", __cu_suite_setup, __cu_suite_teardown, __cu_test_setup, __cu_test_teardown);
CUNIT_CI_TEST(test_basic);
return CU_CI_RUN_SUITES();
}

View File

@ -13,7 +13,8 @@ include $(SRCDIR)/config/aros.cfg
#MM- test-library-clean : \
#MM test-library-singlelib-clean \
#MM test-library-peropenerlib-clean \
#MM test-library-userellib-clean
#MM test-library-userellib-clean \
#MM test-library-noincludeslib-clean
#MM- test-cunit : test-library-cunit
@ -41,6 +42,11 @@ USER_LDFLAGS := -L$(TARGETDIR)/$(AROS_DIR_DEVELOPMENT)/lib
files="singlelib" \
prefix=$(TARGETDIR)
%build_module mmake=test-library-noincludeslib \
modname=noincludes modtype=library \
files="noincludeslib" \
prefix=$(TARGETDIR)
FILES := peropenervalue peropenernolib peropenernamechange peropenerinit peropenershareable \
peropenervalue_intralib
@ -66,6 +72,7 @@ USER_CFLAGS := $(CFLAGS_NO_BUILTIN)
USER_LDFLAGS +=
#MM test-library-userel-cunit : linklibs-cunit test-library-userellib test-library-singlelib test-library-peropenerlib
#MM test-library-noincludes-cunit : linklibs-cunit test-library-noincludeslib
%build_prog mmake=test-library-single-autoopen-cunit \
progname=cunit-library-single-autoopen targetdir=$(CUNITEXEDIR) \
@ -75,6 +82,10 @@ USER_LDFLAGS +=
progname=cunit-library-single targetdir=$(CUNITEXEDIR) \
uselibs="single cunit"
%build_prog mmake=test-library-noincludes-cunit \
progname=cunit-library-noincludes targetdir=$(CUNITEXEDIR) \
uselibs="noincludes cunit"
%build_prog mmake=test-library-userel-cunit \
progname=cunit-library-userel targetdir=$(CUNITEXEDIR) \
uselibs="userel peropener cunit"
@ -157,6 +168,7 @@ USER_CPPFLAGS :=
#MM test-library-peropener-shareable-cunit \
#MM test-library-peropener-varsglobal-cunit \
#MM test-library-peropener-intralib-cunit \
#MM test-library-noincludes-cunit
#MM- test-library-cunit-quick : \
#MM test-library-userel-cunit-quick \
@ -170,5 +182,6 @@ USER_CPPFLAGS :=
#MM test-library-peropener-shareable-cunit-quick \
#MM test-library-peropener-varsglobal-cunit-quick \
#MM test-library-peropener-intralib-cunit-quick \
#MM test-library-noincludes-cunit-quick
%common

View File

@ -0,0 +1,13 @@
##begin config
version 1.0
options noincludes
##end config
##begin cdefprivate
##end cdefprivate
##begin functionlist
void RegSetValue(LONG v) (D0)
int StackGetValue()
##end functionlist

View File

@ -0,0 +1,35 @@
/*
Copyright (C) 2024, The AROS Development Team. All rights reserved.
Desc:
*/
#include <stdarg.h>
#include <exec/types.h>
#include <aros/libcall.h>
#include <proto/dos.h>
#include <proto/exec.h>
#include LC_LIBDEFS_FILE
#include "singlebase.h"
LONG val;
AROS_LH1(void, RegSetValue,
AROS_LHA(LONG, v, D0),
struct Library *, NoincludesBase, 5, Noincludes
)
{
AROS_LIBFUNC_INIT
val = v;
AROS_LIBFUNC_EXIT
}
int StackGetValue()
{
return val;
}

View File

@ -24,6 +24,7 @@ If NOT WARN
Execute S/Test cunit/library/cunit-library-peropener-shareable ;Library_Peropener_Shareable_Suite
Execute S/Test cunit/library/cunit-library-peropener-varsglobal ;Library_Peropener_VarsGlobal_Suite
Execute S/Test cunit/library/cunit-library-peropener-intralib ;Library_Peropener_IntraLib_Suite
Execute S/Test cunit/library/cunit-library-noincludes ;Library_Noincludes_Suite
EndIf
; Perform basic "exec.library" unit tests...