| Summary: | [rlImport] When run rlImport pkg/lib1 pkg/lib2, in lib2 can not find the function defined in lib1 | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | JianHong Yin <jiyin> |
| Component: | beakerlib | Assignee: | Petr Muller <pmuller> |
| Status: | CLOSED WORKSFORME | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | urgent | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 19 | CC: | ohudlick, pmuller, psplicha |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2014-02-18 15:07:52 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
[root@dhcp12-241 oldnfs]# make run test -x runtest.sh || chmod a+x runtest.sh ./runtest.sh :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ LOG ] :: Setup :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: [ 15:33:53 ] :: [ INFO ] :: rlImport: Found 'kernel/base' in /mnt/tests :: [ 15:33:53 ] :: [ INFO ] :: rlImport: Will try to import kernel/base from /mnt/tests/kernel/Library/base/lib.sh :: [ 15:33:53 ] :: [ INFO ] :: rlImport: Found 'kernel/oldnfs' in /mnt/tests :: [ 15:33:53 ] :: [ INFO ] :: rlImport: Will try to import kernel/oldnfs from /mnt/tests/kernel/Library/oldnfs/lib.sh /mnt/tests/kernel/Library/oldnfs/lib.sh: line 39: is_rhel5: command not found /mnt/tests/kernel/Library/oldnfs/lib.sh: line 295: is_rhel7: command not found Will look into it. On a side note, you might be interested in the rlIsRHEL functions in BeakerLib which could help you with whatever you are doing in the is_rhelX functions. I have looked into this, constructing the structure as follows:
==============================================
$ cat component/Library/basic/lib.sh:
# library-prefix = basic
basicLibraryLoaded() {}
basicLibraryFunction() {}
$ cat component/Library/use_basic/lib.sh
# library-prefix = use_basic
basicLibraryFunction # called when importing
use_basicLibraryLoaded() { basicLibraryFunction; } # called when import verified
use_basicLibraryFunction() { basicLibraryFunction; } # called when called from test
$ cat component/Sanity/dummy/runtest.sh
#!/usr/bin/bash
. /usr/share/beakerlib/beakerlib.sh
rlJournalStart
rlPhaseStartSetup
rlImport fakeroot/basic fakeroot/use_basic
rlRun "use_basicLibraryFunction"
rlRun "basicLibraryFunction"
rlPhaseEnd
rlJournalEnd
==============================================
The important thing to note is that in this case, the component/Library/use_basic/Makefile file needs to declare 'RhtsRequires: library(component/basic)', or we do not know about the dependency. Then, simple 'rlImport component/use_basic' would work: and that is how it should work. We need to the dependency chain to be declared, so we can work with it.
If I do not have such Makefile in Library/use_basic, I observe results similar to yours. If I have it, the import works, and the functions too.
I have also looked at the kernel/Library/oldnfs lib, and I do not see the RhtsRequires there. Therefore, I'm closing this bug as the dependency resolving works for me. Please reopen if some part of my assessment is not correct.
|
Description of problem: When run "rlImport pkg/lib1 pkg/lib2", in lib2 can not find the function defined in lib1 But the follow usage works fine, rlImport pkg/lib1 rlImport pkg/lib2 Version-Release number of selected component (if applicable): beakerlib-1.8-1.fc19.noarch How reproducible: 100% Steps to Reproduce: 1. . /usr/share/beakerlib/beakerlib.sh 2. rlImport kernel/base kernel/oldnfs 3. Actual results: [root@dhcp12-241 nfs-utils]# rlImport kernel/base kernel/oldnfs :: [ 15:19:43 ] :: [ INFO ] :: rlImport: Found 'kernel/base' in /mnt/tests :: [ 15:19:43 ] :: [ INFO ] :: rlImport: Will try to import kernel/base from /mnt/tests/kernel/Library/base/lib.sh :: [ 15:19:43 ] :: [ INFO ] :: rlImport: Found 'kernel/oldnfs' in /mnt/tests :: [ 15:19:43 ] :: [ INFO ] :: rlImport: Will try to import kernel/oldnfs from /mnt/tests/kernel/Library/oldnfs/lib.sh -bash: is_rhel5: command not found -bash: is_rhel7: command not found these two is function defined in kernel/base Expected results: not error "command not found" happen. Additional info: