[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT/RUBY PATCH 13/16] tests: Build tests



Please change the names of the links created for the unit tests from
using - (dash), to using _ (underscore). The build system
automatically generates some macros that take the file names as
parameters, and create functions named by the format Init_<filename>,
and functions cannot have dashes in their names.

Also there is a problem with "extconf.h" file. It can't be found when
building with tests enabled.

On Sun, Dec 8, 2019 at 11:56 AM Costin Lupu <costin.lupu@xxxxxxxxx> wrote:
>
> The Ruby unit testing depends on both extensions and encodings. We currently
> add support for running only the time and file tests. Enabling the rest of the
> tests is subject of further work.
>
> Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
> ---
>  Config.uk               |  7 +++++++
>  Makefile.uk             | 40 ++++++++++++++++++++++++++++++++++++++++
>  generated/ext/extinit.c |  6 ++++++
>  3 files changed, 53 insertions(+)
>
> diff --git a/Config.uk b/Config.uk
> index b4c5bff..8f6d689 100644
> --- a/Config.uk
> +++ b/Config.uk
> @@ -129,4 +129,11 @@ config LIBRUBY_ENC
>         depends on !LIBRUBY_MINI
>         default y
>
> +config LIBRUBY_TEST
> +       bool "Enable unit testing"
> +       depends on !LIBRUBY_MINI
> +       depends on LIBRUBY_EXT
> +       depends on LIBRUBY_ENC
> +       default y
> +
>  endif
> diff --git a/Makefile.uk b/Makefile.uk
> index 9f66606..a7aeb9a 100644
> --- a/Makefile.uk
> +++ b/Makefile.uk
> @@ -41,6 +41,7 @@
>  $(eval $(call addlib_s,libruby,$(CONFIG_LIBRUBY)))
>  $(eval $(call addlib_s,libruby_ext,$(CONFIG_LIBRUBY_EXT)))
>  $(eval $(call addlib_s,libruby_enc,$(CONFIG_LIBRUBY_ENC)))
> +$(eval $(call addlib_s,libruby_test,$(CONFIG_LIBRUBY_TEST)))
>
>  
> ################################################################################
>  # Sources
> @@ -538,10 +539,49 @@ LIBRUBY_ENC_SRCS-y += 
> $(LIBRUBY_SRC)/enc/trans/single_byte.c
>  LIBRUBY_ENC_SRCS-y += $(LIBRUBY_SRC)/enc/trans/utf8_mac.c
>  LIBRUBY_ENC_SRCS-y += $(LIBRUBY_SRC)/enc/trans/utf_16_32.c
>
> +################################################################################
> +# Unit testing
> +################################################################################
> +LIBRUBY_TEST_CFLAGS-y += $(LIBRUBY_CINCLUDES-y)
> +LIBRUBY_TEST_CFLAGS-y += $(LIBRUBY_SUPPRESS_FLAGS)
> +LIBRUBY_TEST_CFLAGS-y += -DRUBY_EXTCONF_H=\"extconf.h\"
> +
> +$(LIBRUBY_SRC)/ext/-test-/file/init-file.c: 
> $(LIBRUBY_SRC)/ext/-test-/file/init.c
> +       ln -s $< $@
> +LIBRUBY_TEST_SRCS-y += $(LIBRUBY_SRC)/ext/-test-/file/init-file.c
> +LIBRUBY_TEST_INIT-FILE_FLAGS-y += -I$(LIBRUBY_BASE)/ext/-test-/file
> +LIBRUBY_TEST_SRCS-y += $(LIBRUBY_SRC)/ext/-test-/file/fs.c
> +LIBRUBY_TEST_FS_FLAGS-y += -I$(LIBRUBY_BASE)/ext/-test-/file
> +LIBRUBY_TEST_SRCS-y += $(LIBRUBY_SRC)/ext/-test-/file/stat.c
> +LIBRUBY_TEST_STAT_FLAGS-y += -I$(LIBRUBY_BASE)/ext/-test-/file
> +
> +$(LIBRUBY_SRC)/ext/-test-/time/init-time.c: 
> $(LIBRUBY_SRC)/ext/-test-/time/init.c
> +       ln -s $< $@
> +LIBRUBY_TEST_SRCS-y += $(LIBRUBY_SRC)/ext/-test-/time/init-time.c
> +LIBRUBY_TEST_INIT-TIME_FLAGS-y += -I$(LIBRUBY_BASE)/ext/-test-/time
> +LIBRUBY_TEST_SRCS-y += $(LIBRUBY_SRC)/ext/-test-/time/leap_second.c
> +LIBRUBY_TEST_LEAP_SECOND_FLAGS-y += -I$(LIBRUBY_BASE)/ext/-test-/time
> +LIBRUBY_TEST_SRCS-y += $(LIBRUBY_SRC)/ext/-test-/time/new.c
> +LIBRUBY_TEST_NEW_FLAGS-y += -I$(LIBRUBY_BASE)/ext/-test-/time
> +
>  
> ################################################################################
>  # Prepare rules
>  
> ################################################################################
>
> +# Customize config: configure stack size
> +$(APP_BASE)/.config.orig: $(APP_BASE)/.config
> +       $(call verbose_cmd,CONFIG,libruby: $(notdir $@), \
> +               cp $(APP_BASE)/.config $@ && \
> +               sed -i 
> 's/^CONFIG_STACK_SIZE_PAGE_ORDER=.*$$/CONFIG_STACK_SIZE_PAGE_ORDER=10/g' 
> $(APP_BASE)/.config)
> +
> +LIBRUBY_TEST_PREPARED_DEPS = \
> +       $(APP_BASE)/.config.orig \
> +
> +$(LIBRUBY_TEST_BUILD)/.prepared: $(LIBRUBY_TEST_PREPARED_DEPS)
> +
> +UK_PREPARE += $(LIBRUBY_TEST_BUILD)/.prepared
> +
> +
>  # Configure origin
>  $(LIBRUBY_BUILD)/.configured: $(LIBRUBY_BUILD)/.origin
>         cd $(LIBRUBY_SRC) && \
> diff --git a/generated/ext/extinit.c b/generated/ext/extinit.c
> index ce2e77c..3af3632 100644
> --- a/generated/ext/extinit.c
> +++ b/generated/ext/extinit.c
> @@ -102,4 +102,10 @@ void Init_ext(void)
>  #if CONFIG_LIBRUBY_EXT_RIPPER
>      init(Init_sdbm, "sdbm");
>  #endif
> +
> +#if CONFIG_LIBRUBY_TEST
> +    /* TODO add more tests */
> +    init(Init_time, "-test-/file");
> +    init(Init_time, "-test-/time");
> +#endif
>  }
> --
> 2.20.1
>
>
> _______________________________________________
> Minios-devel mailing list
> Minios-devel@xxxxxxxxxxxxxxxxxxxx
> https://lists.xenproject.org/mailman/listinfo/minios-devel

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.