Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1) Added new code under linux-tools , this code can be usefull for b… #122

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

abhipsnl
Copy link
Contributor

@abhipsnl abhipsnl commented Aug 3, 2017

…uilding packages under ubuntu OS.

  1. Apart from this modified existing code based on previous commit comments .

    New changes are given below
    a) Changes from 'sh' to 'bash' in wrapper script
    b) Propers comments on Wrapper script.
    c) Handled return code properly for warning

NOTE : Previous pull request was failed , that too need to be merged

…ilding packages under ubuntu OS.

2) Apart from this modified existing code based on previous commit comments .

   New changes are given below
   a) Changes from 'sh' to 'bash' in wrapper script
   b) Propers comments on Wrapper script.
   c) Handled return code properly for warning
@@ -89,14 +89,22 @@ function tc_local_setup()
{
tc_exec_or_break $REQUIRED || return

tc_exist_or_break /etc/prelink.conf /etc/sysconfig/prelink || return
#tc_exist_or_break /etc/prelink.conf /etc/sysconfig/prelink || return
tc_exist_or_break /etc/prelink.conf /usr/sbin/prelink || return

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please Correct Summary !

In tc_exec_or_break $REQUIRED prelink check is done.
And how about distros which has /etc/sysconfig/prelink ? This change has to be made generic to work in all the cases.


tc_get_os_arch
userlibdir=/usr/lib
libdir=/lib/
[ $TC_OS_ARCH = "x86_64" ] || [ $TC_OS_ARCH = "ppc64" ] || [ $TC_OS_ARCH = "s390x" ] \
&& userlibdir=/usr/lib64/ && \
libdir=/lib64/
# On Ubuntu usrlib and lib paths are diff, so modified the code based on that
grep -i "ubuntu" /etc/*-release >/dev/null 2>&1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below change is specific for x86_64 arch. but prelink is available for power as well.
Please modify this change to work on all archs.

tc_fail_if_bad $? "prelink failed on cycle1" || return

# cycle1lib1.so libs are not part of Ubuntu, so excluding this test
grep -i "ubuntu" /etc/*-release >/dev/null 2>&1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cycle1lib1.so libs are created for test purpose ? If so this cannot be built for ubuntu ?

##
## FILE: README.txt
##
## DESCRIPTION: This File contains the steps of build and test autotest tests for all Linux Destro
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace Destro to Distribution , where ever mentioned


Supported Linux Destro : Redhat,Ubuntu,suse,CentOS
Supported Arch : Intel X86_64 and ia32
IBM Power (ppc,ppc64,ppc64le,ppcnf)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure it builds for ppcnf?


1) Git clone the latest autotest and autotest-linux-tools
2) Based on the arguments build the required packages and copy to autotest-linux-tools
3) Run the Regression test.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modify Step 2 autotest-linux-tools to autotest-client-tests/linux-tools
Step 3 has to be Run autotest-client-tests

curl
checkpolicy
cracklib
git
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add all packages into input_file which has tests inside autotest and are identified for ubuntu

 Based on the previous comments I have modified the code.

 NOTE : Previous 2 pull request failed due to build error, need merge those too
@athira-rajeev
Copy link
Contributor

Abhishek,
For Travis CI build failure, job log shows "The command "inspekt lint" exited with 1."
So please check your code with "inspekt"

The objective of this script is to build the test binaries which are useful and needed by autotest-client-tests. Though this is a build tool ( not a testcase ) , while reviewing observed that script is not using any autotest framework code( for logging/executing commands ) . @lmr can we have this code under linux-tools ?

if input_tag in SUPPORTED_DIST:
continue
else:
display_message_fn("This %s tag is currently Supported" %input_tag,"ERROR")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct the error message as "not supported"



#############################################
# Check current destro
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it has to be distro/distribution



class ubuntu_conf:
build_src_distribution = ['xenial'] # for rhel or suse mentioned the distribution name or distribution version rhel7.4 for building
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a single run tests can be built for only one release , so make this var as a single one instead of list

# Module to check given release is supported or not
######################################################
def verify_distro_release_fn():
for input_tag in SRC_DIST:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for loop is not requried as the tool doesn't support multiple release builds in one run

logdir = "%s/logs" %basedir
logfile = "%s/final_report.logs" %logdir
package_list_file = "/home/ubuntu/autotest-build-tools/input_file" # This file will contain the package name to be build
binary_src_dir = "%s/autotest-binaries" %basedir # All the compile binaries will be copied in this location, you can change based on your requirement
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to include the build_src_distribution in the DIR structure as we can easily differentiate the builds based on versions.

display_message_fn("Updating %s entries on %s file"%(l_distro_type,REPO_FILE),"INFO")
copy_status = os.system("sudo cp %s %s_bkp "%(REPO_FILE,REPO_FILE))
if copy_status != 0:
display_message_fn("Failed wahile taking the backup of %s file"%REPO_FILE,"ERROR")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/wahile/while

#########################################################################
# Module to revert back all the system changes one the task is finished
#########################################################################
def revert_back_changes_fn():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is not required?
function call has been commented below!

tc_register "passwd --warning"
passwd --warning=9 $TC_TEMP_USER 1>$stdout 2>$stderr
tc_pass_or_fail $? "settings to warn user before 9 days of password expiration failed"
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In ubuntu, passwd has different option for all above tests
-x, --maxdays MAX_DAYS
-n, --mindays MIN_DAYS
-w, --warndays WARN_DAYS

They have to be handled for ubuntu as well

#Force to unlock user password which is empty
tc_register "passwd --force"
passwd --unlock --force $TC_TEMP_USER 1>$stdout 2>$stderr
tc_pass_or_fail $? "Failed to force unlock passwd for $TC_TEMP_USER"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see --keep-tokens option on ubuntu zesty, why it should not be executed here?

@@ -56,7 +63,12 @@ function tc_local_cleanup()
function run_test()
{
pushd $PATCHUTILS_TESTS_DIR >$stdout 2>$stderr
TST_TOTAL=`ls tests -I common.sh -I soak-test | wc -l`
grep -i "ubuntu" /etc/*-release >/dev/null 2>&1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"grep -i "ubuntu" /etc/*-release" is being called multiple times in multiple scripts
declare DISTRO in a shared function and use it all over here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants