On Thu, Aug 27, 2020 at 5:25 PM Chris Johns <chr...@rtems.org> wrote: > > On 28/8/20 1:44 am, Gedare Bloom wrote: > > On Wed, Aug 26, 2020 at 10:56 PM <chr...@rtems.org> wrote: > >> > >> From: Chris Johns <chr...@rtems.org> > >> > >> - Add a simpler TFTP to allow parallel test hardware > >> > >> - Remove the imported tftpy server > >> > >> Closes #4063 > >> --- > >> tester/rt/tftp.py | 37 +- > >> tester/rt/tftpserver.py | 619 +++++++++++++++++++++++++++ > >> tester/rt/tftpy/COPYING | 21 - > >> tester/rt/tftpy/README | 115 ----- > >> tester/rt/tftpy/TftpClient.py | 107 ----- > >> tester/rt/tftpy/TftpContexts.py | 429 ------------------- > >> tester/rt/tftpy/TftpPacketFactory.py | 47 -- > >> tester/rt/tftpy/TftpPacketTypes.py | 494 --------------------- > >> tester/rt/tftpy/TftpServer.py | 271 ------------ > >> tester/rt/tftpy/TftpShared.py | 52 --- > >> tester/rt/tftpy/TftpStates.py | 611 -------------------------- > >> tester/rt/tftpy/__init__.py | 27 -- > >> tester/rtems-tftp-server | 46 ++ > >> 13 files changed, 685 insertions(+), 2191 deletions(-) > >> create mode 100644 tester/rt/tftpserver.py > >> delete mode 100644 tester/rt/tftpy/COPYING > >> delete mode 100644 tester/rt/tftpy/README > >> delete mode 100644 tester/rt/tftpy/TftpClient.py > >> delete mode 100644 tester/rt/tftpy/TftpContexts.py > >> delete mode 100644 tester/rt/tftpy/TftpPacketFactory.py > >> delete mode 100644 tester/rt/tftpy/TftpPacketTypes.py > >> delete mode 100644 tester/rt/tftpy/TftpServer.py > >> delete mode 100644 tester/rt/tftpy/TftpShared.py > >> delete mode 100644 tester/rt/tftpy/TftpStates.py > >> delete mode 100644 tester/rt/tftpy/__init__.py > >> create mode 100755 tester/rtems-tftp-server > >> > >> diff --git a/tester/rt/tftp.py b/tester/rt/tftp.py > >> index d518036..46a1d11 100644 > >> --- a/tester/rt/tftp.py > >> +++ b/tester/rt/tftp.py > >> @@ -43,7 +43,7 @@ import sys > >> from rtemstoolkit import error > >> from rtemstoolkit import reraise > >> > >> -import tftpy > >> +import tftpserver > >> > >> class tftp(object): > >> '''RTEMS Testing TFTP base.''' > >> @@ -88,7 +88,7 @@ class tftp(object): > >> def _stop(self): > >> try: > >> if self.server: > >> - self.server.stop(now = True) > >> + self.server.stop() > >> except: > >> pass > >> > >> @@ -101,6 +101,10 @@ class tftp(object): > >> > >> def _timeout(self): > >> self._stop() > >> + while self.running or not self.finished: > >> + self._unlock('_timeout') > >> + time.sleep(0.1) > >> + self._lock('_timeout') > >> if self.timeout is not None: > >> self.timeout() > >> > >> @@ -119,22 +123,21 @@ class tftp(object): > >> return None > >> > >> def _listener(self): > >> - tftpy_log = logging.getLogger('tftpy') > >> - tftpy_log.setLevel(100) > >> + self._lock('_listener') > >> + exe = self.exe > >> + self.exe = None > >> + self._unlock('_listener') > >> + self.server = tftpserver.tftp_server(host = 'all', > >> + port = self.port, > >> + timeout = 1, > >> + forced_file = exe, > >> + sessions = 1) > >> try: > >> - self.server = tftpy.TftpServer(tftproot = '.', > >> - dyn_file_func = > >> self._exe_handle) > >> - except tftpy.TftpException as te: > >> - raise error.general('tftp: %s' % (str(te))) > >> - if self.server is not None: > >> - try: > >> - self.server.listen('0.0.0.0', self.port, 0.5) > >> - except tftpy.TftpException as te: > >> - raise error.general('tftp: %s' % (str(te))) > >> - except IOError as ie: > >> - if ie.errno == errno.EACCES: > >> - raise error.general('tftp: permissions error: check > >> tftp server port') > >> - raise error.general('tftp: io error: %s' % (str(ie))) > >> + self.server.start() > >> + self.server.run() > >> + except: > >> + self.server.stop() > >> + raise > >> > >> def _runner(self): > >> self._lock('_runner') > >> diff --git a/tester/rt/tftpserver.py b/tester/rt/tftpserver.py > >> new file mode 100644 > >> index 0000000..b307bd2 > >> --- /dev/null > >> +++ b/tester/rt/tftpserver.py > >> @@ -0,0 +1,619 @@ > >> +# > >> +# Copyright 2020 Chris Johns (chris@contemporary.software) > > Nice email. > > Oh haha I had not noticed this was in the file. > > > > >> +# All rights reserved. > >> +# > >> +# Permission to use, copy, modify, and/or distribute this software for any > >> +# purpose with or without fee is hereby granted, provided that the above > >> +# copyright notice and this permission notice appear in all copies. > >> +# > >> +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > >> +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > >> +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR > >> +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES > >> +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN > >> +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > >> +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > >> + > > Not the preferred file block: > > https://docs.rtems.org/branches/master/eng/coding-file-hdr.html#python-file-template > > > > But, we could add an MIT template. > > I am fine with having all the code move to the documented template header. > Like > the RSB the repo should be checked and moved over. > > > I don't really have the context to check python code. Please do a pass > > over the guidelines to see if you think you got to them. > > Do you mean section 6.5 in the engineering manual? I have reviewed the guide > lines and I have not passed the code through a formatter or static checker. I > would like to add to waf the ability to run the formatting and static checker > and to migrate all the code. I think it is important but I am not sure how > big a > job it is. I would prefer to make the change sooner rather than later so any > stability issues that happen occur now rather than later in the release cycle. > > Is the code OK to merge? > Yes go ahead. We will get more strict as we get the existing code up to the standards (and as I learn them :)).
> Chris _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel