dracut icon indicating copy to clipboard operation
dracut copied to clipboard

simplify test_setup for each test

Open LaszloGombos opened this issue 3 years ago • 0 comments

Factor out common part of each test_setup() function and move it to test-functions file so that it can be shared and reused for each test.

. E.g. the following steps seems to be common for most tests

        mkdir -p "$initdir"    
        . "$basedir"/dracut-init.sh                                                                                                                                                                          
        (                                                                                                                                                                                                    
            cd "$initdir" || exit                                                                                                                                                                            
            mkdir -p -- dev sys proc etc var/run tmp                                                                                                                                                         
            mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin                                                                                                                                                 
        )
        inst_simple "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"                                                                                                                         
        inst_simple "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"                                                                                                                 
        inst_binary "${basedir}/dracut-util" "/usr/bin/dracut-util"                                                                                                                                          
        ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"                                                                                                                                                 
        ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"  

Perhaps we can create a dracut/test/test-lib folder and move some existing common files there that can be shared between tests

  • test-functions
  • run-qemu
  • finished-false.sh
  • hard-off.sh
  • test-init.sh

LaszloGombos avatar Aug 14 '22 02:08 LaszloGombos