mirror of https://github.com/deadw00d/AROS.git
Add test for calling reg function from stack function inside library
Using __aros_getbase_PeropenerBase and proto/peropener.h. This test purpose is to test that functionality changed in previous commit continues working.
This commit is contained in:
parent
9513d8ca08
commit
a8d3a4aee8
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
Copyright Š 2024, The AROS Development Team. All rights reserved.
|
||||
$Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <proto/exec.h>
|
||||
#include <proto/peropener.h>
|
||||
|
||||
#include <CUnit/CUnitCI.h>
|
||||
|
||||
struct Library *PeropenerBase = NULL;
|
||||
|
||||
CU_SUITE_SETUP()
|
||||
{
|
||||
return CUE_SUCCESS;
|
||||
}
|
||||
|
||||
CU_SUITE_TEARDOWN()
|
||||
{
|
||||
return CUE_SUCCESS;
|
||||
}
|
||||
|
||||
CU_TEST_SETUP()
|
||||
{
|
||||
}
|
||||
|
||||
CU_TEST_TEARDOWN()
|
||||
{
|
||||
}
|
||||
|
||||
void test_stack_call_that_goes_internally_through_reg_call()
|
||||
{
|
||||
CU_ASSERT_EQUAL_FATAL(PeropenerBase, NULL);
|
||||
|
||||
PeropenerBase = OpenLibrary("peropener.library", 0L);
|
||||
CU_ASSERT_NOT_EQUAL_FATAL(PeropenerBase, NULL);
|
||||
|
||||
PeropenerSetValueStackThroughInternalReg(5);
|
||||
CU_ASSERT_EQUAL(PeropenerGetValueReg(), 5);
|
||||
|
||||
CloseLibrary(PeropenerBase);
|
||||
PeropenerBase = NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
CU_CI_DEFINE_SUITE("Library_Peropener_IntraLib_Suite", __cu_suite_setup, __cu_suite_teardown, __cu_test_setup, __cu_test_teardown);
|
||||
CUNIT_CI_TEST(test_stack_call_that_goes_internally_through_reg_call);
|
||||
return CU_CI_RUN_SUITES();
|
||||
}
|
|
@ -41,9 +41,12 @@ USER_LDFLAGS := -L$(TARGETDIR)/$(AROS_DIR_DEVELOPMENT)/lib
|
|||
files="singlelib" \
|
||||
prefix=$(TARGETDIR)
|
||||
|
||||
FILES := peropenervalue peropenernolib peropenernamechange peropenerinit peropenershareable \
|
||||
peropenervalue_intralib
|
||||
|
||||
%build_module mmake=test-library-peropenerlib \
|
||||
modname=peropener modtype=library \
|
||||
files="peropenervalue peropenernolib peropenernamechange peropenerinit peropenershareable" \
|
||||
files="$(FILES)" \
|
||||
linklibfiles="peropenervalue_linklib" \
|
||||
prefix=$(TARGETDIR)
|
||||
|
||||
|
@ -84,6 +87,10 @@ USER_LDFLAGS +=
|
|||
progname=cunit-library-peropener-varsglobal targetdir=$(CUNITEXEDIR) \
|
||||
uselibs="peropener cunit"
|
||||
|
||||
%build_prog mmake=test-library-peropener-intralib-cunit \
|
||||
progname=cunit-library-peropener-intralib targetdir=$(CUNITEXEDIR) \
|
||||
uselibs="peropener cunit"
|
||||
|
||||
FILES := cunit-library-single-global \
|
||||
cunit-library-single-global-reg-define \
|
||||
cunit-library-single-global-reg-inline \
|
||||
|
@ -148,7 +155,8 @@ USER_CPPFLAGS :=
|
|||
#MM test-library-peropener-local-cunit \
|
||||
#MM test-library-peropener-relative-cunit \
|
||||
#MM test-library-peropener-shareable-cunit \
|
||||
#MM test-library-peropener-varsglobal-cunit
|
||||
#MM test-library-peropener-varsglobal-cunit \
|
||||
#MM test-library-peropener-intralib-cunit \
|
||||
|
||||
#MM- test-library-cunit-quick : \
|
||||
#MM test-library-userel-cunit-quick \
|
||||
|
@ -160,6 +168,7 @@ USER_CPPFLAGS :=
|
|||
#MM test-library-peropener-local-cunit-quick \
|
||||
#MM test-library-peropener-relative-cunit-quick \
|
||||
#MM test-library-peropener-shareable-cunit-quick \
|
||||
#MM test-library-peropener-varsglobal-cunit-quick
|
||||
#MM test-library-peropener-varsglobal-cunit-quick \
|
||||
#MM test-library-peropener-intralib-cunit-quick \
|
||||
|
||||
%common
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
##begin config
|
||||
version 3.0
|
||||
version 4.0
|
||||
libbasetype struct PeropenerBase
|
||||
options peropenerbase,rellinklib
|
||||
##end config
|
||||
|
@ -26,4 +26,5 @@ int PeropenerGetGlobalPeropenerValueReg() ()
|
|||
void Peropener_AllowShareable(struct Library *base)
|
||||
struct Library * Peropener_GetShareable(struct Library *base)
|
||||
void Peropener_DisallowShareable(struct Library *base)
|
||||
void PeropenerSetValueStackThroughInternalReg(int v)
|
||||
##end functionlist
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
Copyright (C) 2024, The AROS Development Team. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <proto/peropener.h>
|
||||
|
||||
/* This file contains logic for testing library calls from withint itself */
|
||||
|
||||
void PeropenerSetValueStackThroughInternalReg(int value)
|
||||
{
|
||||
struct Library *PeropenerBase = __aros_getbase_PeropenerBase();
|
||||
|
||||
PeropenerSetValueReg(value);
|
||||
}
|
|
@ -23,6 +23,7 @@ If NOT WARN
|
|||
Execute S/Test cunit/library/cunit-library-peropener-relative ;Library_Peropener_Relative_Suite
|
||||
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
|
||||
EndIf
|
||||
|
||||
; Perform basic "exec.library" unit tests...
|
||||
|
|
Loading…
Reference in New Issue