Project

General

Profile

action #67894

Updated by SLindoMansilla over 4 years ago

## Tasks 

 - Add` _multibuild` to include qa-tests flavor Add specfile for package testing to https://build.opensuse.org/package/show/devel:tools:building/scons 
   - **scons-tests.spec** 
 - Add tests as **scons-tests.tar.gz** with content 
   - **hello-world.c** 
   - **Makefile** 
   - **simple-test/SConstruct** 
   - **simple-test/hello-world.c** -> ../hello-world.c 
   - **target-output/SConstruct** 
   - **target-output/hello-world.c** -> ../hello-world.c 

 ## File contents 

 #### hello-world.c 

 ```c 
 #include <stdio.h> 

 int main(int argc, char *argv[]) { 
   printf("Hello world \n"); 
 } 
 ``` 

 #### Makefile 

 ```Makefile 
 .DEFAULT_GOAL := help 

 SHELL     = /bin/sh 
 COMPILE = scons 

 software_name = scons-tests 
 prefix          = /usr/local 
 srcdir          = $(prefix)/src 
 software_srcdir = $(srcdir)/$(software_name) 

 .PHONY: clean_all 
 clean_all: 
         rm --force simple-test/hello-world 
         rm --force simple-test/hello-world.o 
         rm --force target-output/hello-world.o 
         rm --force target-output/hello-world-target-output 

 .PHONY: help 
 help: 
         @echo "Use make tests to execute tests" 

 .PHONY: last_test 
 last_test: target_output 

 .PHONY: simple_test 
 simple_test: 
         cd simple-test && $(COMPILE) 
         [ -f simple-test/hello-world ] 
         simple-test/hello-world |grep "Hello world" 

 .PHONY: target_output 
 target_output: simple_test 
         cd target-output && $(COMPILE) 
         [ -f target-output/hello-world-target-output ] 
         target-output/hello-world-target-output |grep "Hello world" 

 .PHONY: tests 
 tests: last_test 
 ``` 

 #### simple-test/SConstruct                                                                                                                                    

 ```python ```SConstruct 
 print("Minimal compilation")                                                                                                                                    Program('hello-world.c') 
 ``` 


 #### target-output/SConstruct 

 ```python ```SConstruct 
 print("Specify target output") 
 Program('hello-world-target-output', 'hello-world.c') 
 ``` 

 #### _multibuild 

 ```xml 
 <multibuild> 
   <flavor>tests</flavor> 
   <flavor>qa-tests</flavor> 
 </multibuild> 
 ``` 


 ## Examples 

 - Multibuild for openQA: https://build.opensuse.org/package/view_file/devel:openQA/openQA/_service:set_version:obs_scm:openQA-test.spec?expand=1 
 - Multibuild for python-flaky: https://build.opensuse.org/package/view_file/openSUSE:Factory/python-flaky/python-flaky.spec?expand=1

Back