<p>dexter has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/pysim/+/23403">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pySim-shell: add basic filesystem check<br><br>Add a tool (similar to tree) that walks through the FS and selects each<br>file. If the file can not be selected, report an error.<br><br>Change-Id: I9248e2fc067f822d9c4ccc4e48d378eea9ce3354<br>Related: OS#4963<br>---<br>M pySim-shell.py<br>1 file changed, 22 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/03/23403/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/pySim-shell.py b/pySim-shell.py</span><br><span>index 8a0446e..80428c2 100755</span><br><span>--- a/pySim-shell.py</span><br><span>+++ b/pySim-shell.py</span><br><span>@@ -225,6 +225,28 @@</span><br><span>               if context['ERR']:</span><br><span>                   raise RuntimeError("unable to export %i file(s)" % context['ERR'])</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+      def check(self, filename, context):</span><br><span style="color: hsl(120, 100%, 40%);">+           context['COUNT'] += 1</span><br><span style="color: hsl(120, 100%, 40%);">+         path_list = self._cmd.rs.selected_file.fully_qualified_path(True)</span><br><span style="color: hsl(120, 100%, 40%);">+             output_str = "checking: %s" % ('/'.join(path_list)) + "/" + filename</span><br><span style="color: hsl(120, 100%, 40%);">+              output_str += " " * 45</span><br><span style="color: hsl(120, 100%, 40%);">+              output_str = output_str[0:45]</span><br><span style="color: hsl(120, 100%, 40%);">+         try:</span><br><span style="color: hsl(120, 100%, 40%);">+                  fcp_dec = self._cmd.rs.select(filename, self._cmd)</span><br><span style="color: hsl(120, 100%, 40%);">+                    fcp_dec = self._cmd.rs.select("..", self._cmd)</span><br><span style="color: hsl(120, 100%, 40%);">+                      output_str += " ok"</span><br><span style="color: hsl(120, 100%, 40%);">+         except Exception as e:</span><br><span style="color: hsl(120, 100%, 40%);">+                        output_str += " error: " + str(e)</span><br><span style="color: hsl(120, 100%, 40%);">+                   context['ERR'] += 1</span><br><span style="color: hsl(120, 100%, 40%);">+           self._cmd.poutput(output_str)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       def do_check(self, opts):</span><br><span style="color: hsl(120, 100%, 40%);">+             """Check all files in the file system for availability"""</span><br><span style="color: hsl(120, 100%, 40%);">+               context = {'ERR':0, 'COUNT':0}</span><br><span style="color: hsl(120, 100%, 40%);">+                self.walk(0, self.check, context)</span><br><span style="color: hsl(120, 100%, 40%);">+             self._cmd.poutput("total files visited: %u" % context['COUNT'])</span><br><span style="color: hsl(120, 100%, 40%);">+             self._cmd.poutput("bad files:     %u" % context['ERR'])</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> </span><br><span> @with_default_category('USIM Commands')</span><br><span> class UsimCommands(CommandSet):</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/pysim/+/23403">change 23403</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/pysim/+/23403"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: pysim </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I9248e2fc067f822d9c4ccc4e48d378eea9ce3354 </div>
<div style="display:none"> Gerrit-Change-Number: 23403 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>