[LTP] A new API to get distro name?

Zhang, Yixin yixin.zhang@intel.com
Tue May 15 06:03:23 CEST 2018


Hello,

I see that some shell tests are sensitive to distro, but not well managed currently. 
Here are some examples I find:
In test "su01" in scenario "admin_tools", here is the way how it determine the distro (which is incorrect)
  41 tvar=${MACHTYPE%-*}
  42 tvar=${tvar#*-}
  43
  44 # need to export tvar for su01_s1
  45 export tvar
  46 printf "Machine type is: $tvar\n\n"
  47
  48 if [ "$tvar" = "redhat" -o "$tvar" = "redhat-linux" ]
  49 # Need to also set group for TEST_USER2
Similar for cron/at tests in "admin_tools" (the location of deny/allow file is not at the default location for Ubuntu)

Also in test cpuhotplug07, the folder "/usr/src/linux" doesn't exits on Ubuntu, so some modification based on distro is needed.

I'd like to fix them, and need some suggestion: should we add a common API in test.sh or should I just fix them in the test cases derectly? If we plan to add a common API in the test.sh I may need some help as here I don't have all the distro in hand. Thanks. 

Yixin


More information about the ltp mailing list