Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MMirbach committed Mar 15, 2021
1 parent ce25c34 commit 76d5531
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/capture/rs-capture.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// License: Apache 2.0. See LICENSE file in root directory.
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2017 Intel Corporation. All Rights Reserved.

#include <librealsense2/rs.hpp> // Include RealSense Cross Platform API
Expand Down
1 change: 1 addition & 0 deletions unit-tests/func/serializable-device/test-l500-json-load.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
visual_preset_name = rs.l500_visual_preset(int(visual_preset_number))

test.check_equal(visual_preset_name, rs.l500_visual_preset.low_ambient_light)
test.check_equal(visual_preset_name, rs.l500_visual_preset.low_ambient_light)
except:
test.unexpected_exception()
test.finish()
Expand Down
27 changes: 22 additions & 5 deletions unit-tests/py/rspy/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import os, re, platform, subprocess, sys

# Remove Python's default list of places to look for modules so that we use our log module
sys.path = list()
sys.path.append( '' ) # directs Python to search modules in the current directory first
sys.path.append( os.path.dirname( sys.executable ))
Expand All @@ -23,28 +24,41 @@
linux = False

def filesin( root ):
# Yield all files found in root, using relative names ('root/a' would be yielded as 'a')
"""
Yield all files found in root, using relative names ('root/a' would be yielded as 'a')
"""
for (path,subdirs,leafs) in os.walk( root ):
for leaf in leafs:
# We have to stick to Unix conventions because CMake on Windows is fubar...
yield os.path.relpath( path + '/' + leaf, root ).replace( '\\', '/' )

def find( dir, mask ):
"""
Yield all files in given directory (including sub-directories) that fit the given mask
:param dir: directory in which to search
:param mask: mask to compare file names to
"""
pattern = re.compile( mask )
for leaf in filesin( dir ):
if pattern.search( leaf ):
#log.d(leaf)
yield leaf

def is_executable(path_to_test):
def is_executable(path_to_file):
"""
:param path_to_file: path to a file
:return: whether the file is an executable or not
"""
global linux
if linux:
return os.access(path_to_test, os.X_OK)
return os.access(path_to_file, os.X_OK)
else:
return path_to_test.endswith('.exe')
return path_to_file.endswith('.exe')

# wrapper function for subprocess.run
def subprocess_run(cmd, stdout = None):
"""
wrapper function for subprocess.run
"""
log.d( 'running:', cmd )
handle = None
try:
Expand Down Expand Up @@ -75,6 +89,9 @@ def remove_newlines (lines):
yield line

def grep_( pattern, lines, context ):
"""
helper function for grep
"""
index = 0
matches = 0
for line in lines:
Expand Down
2 changes: 1 addition & 1 deletion unit-tests/py/rspy/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import os

# this script is located in librealsense/unit-tests/py/rspy, so one directory up is the main repository
# this script is located in librealsense/unit-tests/py/rspy, so main repository is:
source = os.path.dirname( os.path.dirname( os.path.dirname( os.path.dirname( os.path.abspath( __file__ )))))

def get_bundled_fw_version( product_line ):
Expand Down

0 comments on commit 76d5531

Please sign in to comment.