Test and handle spaces in our build directory
In .gitlab-ci.yml, add spaces and emoji to the build directory name. In CMakeLists.txt, quote a path in a wrapper script. Quote our executable and file paths where needed in our tests.
This commit is contained in:
parent
54b19db4ee
commit
fafb3e3154
|
@ -129,7 +129,8 @@ variables:
|
|||
after_script:
|
||||
# The cache should be large enough to be useful but it shouldn't take
|
||||
# too long to restore+save each run.
|
||||
- ccache --max-size $( du --summarize --block-size=1M "$CI_PROJECT_DIR/build" | awk '{printf ("%dM", $1 * 1.5)}' )
|
||||
- cd "$CI_PROJECT_DIR"
|
||||
- ccache --max-size $( du --total --summarize --block-size=1M *build*/ | awk 'END {printf ("%dM", $1 * 1.5)}' )
|
||||
|
||||
.build-rpm:
|
||||
extends: .build-linux
|
||||
|
@ -620,6 +621,9 @@ Ubuntu GCC Build:
|
|||
needs: [ 'Commit Check' ]
|
||||
script:
|
||||
# build-ubuntu puts us in `build`.
|
||||
- cd ..
|
||||
- mv build "🦈 b u i l d 🦈"
|
||||
- cd "🦈 b u i l d 🦈"
|
||||
- printf "\e[0Ksection_start:%s:cmake_section[collapsed=true]\r\e[0KRunning CMake" "$( date +%s)"
|
||||
# Test release build.
|
||||
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DENABLE_CCACHE=ON -DENABLE_WERROR=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=on ..
|
||||
|
|
|
@ -2764,7 +2764,7 @@ if(BUILD_wireshark AND QT_FOUND)
|
|||
file(WRITE ${CMAKE_BINARY_DIR}/run/wireshark "#!/bin/sh\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/run/wireshark "# Generated by ${CMAKE_CURRENT_LIST_FILE}\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/run/wireshark "# Wrapper script which ensures that we're properly activated via Launch Services\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/run/wireshark "exec ${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/Wireshark \"\$\@\"\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/run/wireshark "exec \"${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/MacOS/Wireshark\" \"\$\@\"\n")
|
||||
execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/wireshark)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -2875,7 +2875,7 @@ if(BUILD_logray AND QT_FOUND)
|
|||
file(WRITE ${CMAKE_BINARY_DIR}/run/logray "#!/bin/sh\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/run/logray "# Generated by ${CMAKE_CURRENT_LIST_FILE}\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/run/logray "# Wrapper script which ensures that we're properly activated via Launch Services\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/run/logray "exec ${CMAKE_BINARY_DIR}/run/Logray.app/Contents/MacOS/Logray \"\$\@\"\n")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}/run/logray "exec \"${CMAKE_BINARY_DIR}/run/Logray.app/Contents/MacOS/Logray\" \"\$\@\"\n")
|
||||
execute_process(COMMAND chmod a+x ${CMAKE_BINARY_DIR}/run/logray)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -63,7 +63,7 @@ def cat_dhcp_command(mode):
|
|||
if sys.executable:
|
||||
sd_cmd = '"{}" '.format(sys.executable)
|
||||
this_dir = os.path.dirname(__file__)
|
||||
sd_cmd += os.path.join(this_dir, 'util_dump_dhcp_pcap.py ' + mode)
|
||||
sd_cmd += '"{}" {}'.format(os.path.join(this_dir, 'util_dump_dhcp_pcap.py'), mode)
|
||||
return sd_cmd
|
||||
|
||||
def cat_cap_file_command(cap_files):
|
||||
|
|
|
@ -72,12 +72,13 @@ def wireshark_k(wireshark_command):
|
|||
return tuple(list(wireshark_command) + ['-k'])
|
||||
|
||||
|
||||
def capture_command(*args, shell=False):
|
||||
def capture_command(*args, shell=False, quoted=False):
|
||||
cmd_args = list(args)
|
||||
if type(cmd_args[0]) != str:
|
||||
# Assume something like ['wireshark', '-k']
|
||||
cmd_args = list(cmd_args[0]) + list(cmd_args)[1:]
|
||||
if shell:
|
||||
cmd_args[0] = f'"{cmd_args[0]}"'
|
||||
cmd_args = ' '.join(cmd_args)
|
||||
return cmd_args
|
||||
|
||||
|
@ -156,7 +157,7 @@ def check_capture_stdin(cmd_capinfos, result_file):
|
|||
slow_dhcp_cmd = cat_dhcp_command('slow')
|
||||
capture_cmd = capture_command(cmd,
|
||||
'-i', '-',
|
||||
'-w', testout_file,
|
||||
'-w', f'"{testout_file}"',
|
||||
'-a', 'duration:{}'.format(capture_duration),
|
||||
shell=True
|
||||
)
|
||||
|
|
|
@ -31,7 +31,7 @@ def fileformats_baseline_str(dirs):
|
|||
class TestFileFormatPcap:
|
||||
def test_pcap_usec_stdin(self, cmd_tshark, capture_file, fileformats_baseline_str, test_env):
|
||||
'''Microsecond pcap direct vs microsecond pcap stdin'''
|
||||
capture_stdout = subprocess.check_output(' '.join((cmd_tshark,
|
||||
capture_stdout = subprocess.check_output(' '.join((f'"{cmd_tshark}"',
|
||||
'-r', '-',
|
||||
'-Tfields',
|
||||
'-e', 'frame.number', '-e', 'frame.time_epoch', '-e', 'frame.time_delta',
|
||||
|
@ -42,7 +42,7 @@ class TestFileFormatPcap:
|
|||
|
||||
def test_pcap_nsec_stdin(self, cmd_tshark, capture_file, fileformats_baseline_str, test_env):
|
||||
'''Microsecond pcap direct vs nanosecond pcap stdin'''
|
||||
capture_stdout = subprocess.check_output(' '.join((cmd_tshark,
|
||||
capture_stdout = subprocess.check_output(' '.join((f'"{cmd_tshark}"',
|
||||
'-r', '-',
|
||||
'-Tfields',
|
||||
'-e', 'frame.number', '-e', 'frame.time_epoch', '-e', 'frame.time_delta',
|
||||
|
@ -65,7 +65,7 @@ class TestFileFormatPcap:
|
|||
class TestFileFormatsPcapng:
|
||||
def test_pcapng_usec_stdin(self, cmd_tshark, capture_file, fileformats_baseline_str, test_env):
|
||||
'''Microsecond pcap direct vs microsecond pcapng stdin'''
|
||||
capture_stdout = subprocess.check_output(' '.join((cmd_tshark,
|
||||
capture_stdout = subprocess.check_output(' '.join((f'"{cmd_tshark}"',
|
||||
'-r', '-',
|
||||
'-Tfields',
|
||||
'-e', 'frame.number', '-e', 'frame.time_epoch', '-e', 'frame.time_delta'
|
||||
|
@ -86,7 +86,7 @@ class TestFileFormatsPcapng:
|
|||
|
||||
def test_pcapng_nsec_stdin(self, cmd_tshark, capture_file, fileformats_baseline_str, test_env):
|
||||
'''Microsecond pcap direct vs nanosecond pcapng stdin'''
|
||||
capture_stdout = subprocess.check_output(' '.join((cmd_tshark,
|
||||
capture_stdout = subprocess.check_output(' '.join((f'"{cmd_tshark}"',
|
||||
'-r', '-',
|
||||
'-Tfields',
|
||||
'-e', 'frame.number', '-e', 'frame.time_epoch', '-e', 'frame.time_delta'
|
||||
|
|
|
@ -116,7 +116,7 @@ def check_text2pcap(cmd_tshark, cmd_text2pcap, cmd_capinfos, capture_file, resul
|
|||
# text2pcap_generate_input()
|
||||
# $TSHARK -o 'gui.column.format:"Time","%t"' -tad -P -x -r $1 > testin.txt
|
||||
testin_file = result_file(testin_txt)
|
||||
tshark_cmd = '{cmd} -r {cf} -o gui.column.format:"Time","%t" -t ad -P --hexdump frames > {of}'.format(
|
||||
tshark_cmd = '"{cmd}" -r "{cf}" -o gui.column.format:"Time","%t" -t ad -P --hexdump frames > "{of}"'.format(
|
||||
cmd = cmd_tshark,
|
||||
cf = cap_file,
|
||||
of = testin_file,
|
||||
|
@ -130,7 +130,7 @@ def check_text2pcap(cmd_tshark, cmd_text2pcap, cmd_capinfos, capture_file, resul
|
|||
# We want the -a flag, because the tshark -x format is a hex+ASCII
|
||||
# format where the ASCII can be confused for hex bytes without it.
|
||||
# XXX: -t ISO also works now too for this output
|
||||
text2pcap_cmd = '{cmd} -a -F {filetype} -l {linktype} -t "%Y-%m-%d %H:%M:%S.%f" {in_f} {out_f}'.format(
|
||||
text2pcap_cmd = '"{cmd}" -a -F {filetype} -l {linktype} -t "%Y-%m-%d %H:%M:%S.%f" "{in_f}" "{out_f}"'.format(
|
||||
cmd = cmd_text2pcap,
|
||||
filetype = filetype_flag,
|
||||
linktype = encap_to_link_type[pre_cap_info['encapsulation']],
|
||||
|
|
Loading…
Reference in New Issue