[OE-core] [PATCH 19/20] oeqa/sdkext: Add devtool basic tests for eSDK.

Paul Eggleton paul.eggleton at linux.intel.com
Tue Feb 2 22:03:45 UTC 2016


On Tue, 02 Feb 2016 09:14:22 Aníbal Limón wrote:
> From: Aníbal Limón <limon.anibal at gmail.com>
> 
> Add simple myapp application is a C app that prints hello world
> and exit.
> 
> Add devtool test for that this app to the workspace, build and
> reset it.
> 
> Signed-off-by: Aníbal Limón <limon.anibal at gmail.com>
> ---
>  meta/lib/oeqa/sdkext/devtool.py           | 25 +++++++++++++++++++++++++
>  meta/lib/oeqa/sdkext/files/myapp/Makefile | 10 ++++++++++
>  meta/lib/oeqa/sdkext/files/myapp/myapp.c  |  9 +++++++++
>  3 files changed, 44 insertions(+)
>  create mode 100644 meta/lib/oeqa/sdkext/devtool.py
>  create mode 100644 meta/lib/oeqa/sdkext/files/myapp/Makefile
>  create mode 100644 meta/lib/oeqa/sdkext/files/myapp/myapp.c
> 
> diff --git a/meta/lib/oeqa/sdkext/devtool.py
> b/meta/lib/oeqa/sdkext/devtool.py new file mode 100644
> index 0000000..0262ed3
> --- /dev/null
> +++ b/meta/lib/oeqa/sdkext/devtool.py
> @@ -0,0 +1,25 @@
> +import shutil
> +
> +from oeqa.oetest import oeSDKExtTest
> +from oeqa.utils.decorators import *
> +
> +class DevtoolTest(oeSDKExtTest):
> +
> +    @classmethod
> +    def setUpClass(self):
> +        self.myapp_src = os.path.join(self.tc.sdkextfilesdir, "myapp")
> +        self.myapp_dst = os.path.join(self.tc.sdktestdir, "myapp")
> +        shutil.copytree(self.myapp_src, self.myapp_dst)
> +
> +    def test_devtool_add_reset(self):
> +        self._run('devtool add myapp %s' % self.myapp_dst)
> +        self._run('devtool reset myapp')
> +
> +    def test_devtool_build(self):
> +        self._run('devtool add myapp %s' % self.myapp_dst)
> +        self._run('devtool build myapp')
> +        self._run('devtool reset myapp')
> +
> +    @classmethod
> +    def tearDownClass(self):
> +        shutil.rmtree(self.myapp_dst)
> diff --git a/meta/lib/oeqa/sdkext/files/myapp/Makefile
> b/meta/lib/oeqa/sdkext/files/myapp/Makefile new file mode 100644
> index 0000000..abd91be
> --- /dev/null
> +++ b/meta/lib/oeqa/sdkext/files/myapp/Makefile
> @@ -0,0 +1,10 @@
> +all: myapp
> +
> +myapp: myapp.o
> +	$(CC) $(LDFLAGS) $< -o $@
> +
> +myapp.o: myapp.c
> +	$(CC) $(CFLAGS) -c $< -o $@
> +
> +clean:
> +	rm -rf myapp.o myapp
> diff --git a/meta/lib/oeqa/sdkext/files/myapp/myapp.c
> b/meta/lib/oeqa/sdkext/files/myapp/myapp.c new file mode 100644
> index 0000000..f0b63f0
> --- /dev/null
> +++ b/meta/lib/oeqa/sdkext/files/myapp/myapp.c
> @@ -0,0 +1,9 @@
> +#include <stdio.h>
> +
> +int
> +main(int argc, char *argv[])
> +{
> +	printf("Hello world\n");
> +
> +	return 0;
> +}

I guess we'll probably want to extend this test so it also looks at the 
binaries produced by the build to see if they're reasonable, but we can do 
that later.

One thing though - could you add a check to see that the 'devtool' command 
we're executing is definitely from the SDK and not the outer build environment 
(or elsewhere)? Presumably you could just do "which devtool" and check the 
output.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre



More information about the Openembedded-core mailing list