* [PATCHv2 1/2] oeqa/utils: added new networke module @ 2016-02-15 19:10 Francisco Pedraza 2016-02-15 19:10 ` [PATCHv2 2/2] oeqa/selftest/prservice: Added new tc: check pr-server stop msg Francisco Pedraza 2016-02-15 19:48 ` [PATCHv2 1/2] oeqa/utils: added new networke module Benjamin Esquivel 0 siblings, 2 replies; 4+ messages in thread From: Francisco Pedraza @ 2016-02-15 19:10 UTC (permalink / raw) To: openembedded-core; +Cc: Francisco Pedraza A network module was added, and will contain network utility funcions for now. with get_free_port that returns availabe network port in the system. Signed-off-by: Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com> --- meta/lib/oeqa/utils/network.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 meta/lib/oeqa/utils/network.py diff --git a/meta/lib/oeqa/utils/network.py b/meta/lib/oeqa/utils/network.py new file mode 100644 index 0000000..2768f6c --- /dev/null +++ b/meta/lib/oeqa/utils/network.py @@ -0,0 +1,8 @@ +import socket + +def get_free_port(): + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.bind(('', 0)) + addr = s.getsockname() + s.close() + return addr[1] -- 2.5.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCHv2 2/2] oeqa/selftest/prservice: Added new tc: check pr-server stop msg 2016-02-15 19:10 [PATCHv2 1/2] oeqa/utils: added new networke module Francisco Pedraza @ 2016-02-15 19:10 ` Francisco Pedraza 2016-02-15 19:48 ` Benjamin Esquivel 2016-02-15 19:48 ` [PATCHv2 1/2] oeqa/utils: added new networke module Benjamin Esquivel 1 sibling, 1 reply; 4+ messages in thread From: Francisco Pedraza @ 2016-02-15 19:10 UTC (permalink / raw) To: openembedded-core; +Cc: Francisco Pedraza When stopping the prserver using localhost as host, it tries to find a file '/tmp/PRServer_127.0.0.1_8585.pid' which is not present on the system. fix for [YOCTO #8258] Signed-off-by: Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com> --- meta/lib/oeqa/selftest/prservice.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/prservice.py b/meta/lib/oeqa/selftest/prservice.py index f22288e..fbde5a6 100644 --- a/meta/lib/oeqa/selftest/prservice.py +++ b/meta/lib/oeqa/selftest/prservice.py @@ -9,9 +9,9 @@ import oeqa.utils.ftools as ftools from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var from oeqa.utils.decorators import testcase +from oeqa.utils.network import get_free_port class BitbakePrTests(oeSelfTest): - def get_pr_version(self, package_name): pkgdata_dir = get_bb_var('PKGDATA_DIR') package_data_file = os.path.join(pkgdata_dir, 'runtime', package_name) @@ -119,3 +119,16 @@ class BitbakePrTests(oeSelfTest): @testcase(936) def test_pr_service_ipk_arch_indep(self): self.run_test_pr_service('xcursor-transparent-theme', 'ipk', 'do_package') + + @testcase(1419) + def test_stopping_prservice_message(self): + output_msg_passed = 'Waiting for pr-server to exit.' + err_msg = 'pidfile /tmp/PRServer_localhost_8585.pid does not exist. Daemon not running?' + + port = get_free_port() + runCmd('bitbake-prserv --host localhost --port %s --loglevel=DEBUG --start' % port) + ret = runCmd('bitbake-prserv --host localhost --port %s --loglevel=DEBUG --stop' % port) + + self.assertNotEqual(ret.output, err_msg) + self.assertEqual(ret.output, output_msg_passed) + -- 2.5.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCHv2 2/2] oeqa/selftest/prservice: Added new tc: check pr-server stop msg 2016-02-15 19:10 ` [PATCHv2 2/2] oeqa/selftest/prservice: Added new tc: check pr-server stop msg Francisco Pedraza @ 2016-02-15 19:48 ` Benjamin Esquivel 0 siblings, 0 replies; 4+ messages in thread From: Benjamin Esquivel @ 2016-02-15 19:48 UTC (permalink / raw) To: Francisco Pedraza, openembedded-core Hi Paco, good to see you doing patches. Please check my comments below. On Mon, 2016-02-15 at 13:10 -0600, Francisco Pedraza wrote: > When stopping the prserver using localhost as host, it tries to > find a file '/tmp/PRServer_127.0.0.1_8585.pid' which is not > present on the system. > > fix for [YOCTO #8258] > > Signed-off-by: Francisco Pedraza < > francisco.j.pedraza.gonzalez@intel.com> > --- > meta/lib/oeqa/selftest/prservice.py | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/meta/lib/oeqa/selftest/prservice.py > b/meta/lib/oeqa/selftest/prservice.py > index f22288e..fbde5a6 100644 > --- a/meta/lib/oeqa/selftest/prservice.py > +++ b/meta/lib/oeqa/selftest/prservice.py > @@ -9,9 +9,9 @@ import oeqa.utils.ftools as ftools > from oeqa.selftest.base import oeSelfTest > from oeqa.utils.commands import runCmd, bitbake, get_bb_var > from oeqa.utils.decorators import testcase > +from oeqa.utils.network import get_free_port > > class BitbakePrTests(oeSelfTest): > - seems like a line delete slipped here above > def get_pr_version(self, package_name): > pkgdata_dir = get_bb_var('PKGDATA_DIR') > package_data_file = os.path.join(pkgdata_dir, 'runtime', > package_name) > @@ -119,3 +119,16 @@ class BitbakePrTests(oeSelfTest): > @testcase(936) > def test_pr_service_ipk_arch_indep(self): > self.run_test_pr_service('xcursor-transparent-theme', 'ipk', > 'do_package') > + > + @testcase(1419) > + def test_stopping_prservice_message(self): > + output_msg_passed = 'Waiting for pr-server to exit.' > + err_msg = 'pidfile /tmp/PRServer_localhost_8585.pid does not > exist. Daemon not running?' while it is good to check for known error conditions, this one seems very specific and could mutate easily. I.e. if the pidfile has a different PID, the error message will not be the same as the one you describe. This is better checked via a search expression. > + > + port = get_free_port() > + runCmd('bitbake-prserv --host localhost --port %s - > -loglevel=DEBUG --start' % port) > + ret = runCmd('bitbake-prserv --host localhost --port %s - > -loglevel=DEBUG --stop' % port) > + > + self.assertNotEqual(ret.output, err_msg) You're checking the expected message first, that makes this second check below for the unexpected message to be highly unlikely to happen at this point. I believe that checking just for the expected message would account for the objective of the test. > + self.assertEqual(ret.output, output_msg_passed) > + > -- > 2.5.0 > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2 1/2] oeqa/utils: added new networke module 2016-02-15 19:10 [PATCHv2 1/2] oeqa/utils: added new networke module Francisco Pedraza 2016-02-15 19:10 ` [PATCHv2 2/2] oeqa/selftest/prservice: Added new tc: check pr-server stop msg Francisco Pedraza @ 2016-02-15 19:48 ` Benjamin Esquivel 1 sibling, 0 replies; 4+ messages in thread From: Benjamin Esquivel @ 2016-02-15 19:48 UTC (permalink / raw) To: Francisco Pedraza, openembedded-core Hi Paco, please fix the typo in the subject as it is the typo of the commit title as well. Check my other comments below and re-send. On Mon, 2016-02-15 at 13:10 -0600, Francisco Pedraza wrote: > A network module was added, and will contain network utility funcions > for now. fix typo in 'functions' > with get_free_port that returns availabe network port in the system. fix typo in 'available' > > Signed-off-by: Francisco Pedraza < > francisco.j.pedraza.gonzalez@intel.com> > --- > meta/lib/oeqa/utils/network.py | 8 ++++++++ > 1 file changed, 8 insertions(+) > create mode 100644 meta/lib/oeqa/utils/network.py > > diff --git a/meta/lib/oeqa/utils/network.py > b/meta/lib/oeqa/utils/network.py > new file mode 100644 > index 0000000..2768f6c > --- /dev/null > +++ b/meta/lib/oeqa/utils/network.py > @@ -0,0 +1,8 @@ > +import socket > + > +def get_free_port(): > + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > + s.bind(('', 0)) > + addr = s.getsockname() > + s.close() > + return addr[1] > -- > 2.5.0 > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-02-15 19:47 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-02-15 19:10 [PATCHv2 1/2] oeqa/utils: added new networke module Francisco Pedraza 2016-02-15 19:10 ` [PATCHv2 2/2] oeqa/selftest/prservice: Added new tc: check pr-server stop msg Francisco Pedraza 2016-02-15 19:48 ` Benjamin Esquivel 2016-02-15 19:48 ` [PATCHv2 1/2] oeqa/utils: added new networke module Benjamin Esquivel
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox