66# shellcheck disable=SC1091
77. ../e2e/lib/utils
88
9- QMCTL_SCRIPT=" ../../tools/qmctl/qmctl"
10-
119info_message " Starting comprehensive qmctl copy tests..."
1210
1311# Check if container is available
14- if ! python3 " $QMCTL_SCRIPT " exec echo " container_check" > /dev/null 2>&1 ; then
12+ if ! qmctl exec echo " container_check" > /dev/null 2>&1 ; then
1513 fail_message " QM container is not available - copy tests cannot run"
1614 echo " Please ensure QM container is running with: sudo systemctl start qm"
1715 exit 1
@@ -21,12 +19,12 @@ info_message "QM container is available - running comprehensive copy tests"
2119
2220# Test 0: Basic copy test (from original qmctl_cp.sh)
2321info_message " Testing: Basic copy test (host to container)"
24- python3 " $QMCTL_SCRIPT " cp ./files/file-to-copy.txt qm:/tmp
22+ qmctl cp ./files/file-to-copy.txt qm:/tmp
2523
2624expected_output_file=" ./files/file-to-check-cp.txt"
2725actual_output_temp_file=$( mktemp)
2826
29- python3 " $QMCTL_SCRIPT " exec cat /tmp/file-to-copy.txt > " $actual_output_temp_file "
27+ qmctl exec cat /tmp/file-to-copy.txt > " $actual_output_temp_file "
3028
3129if diff " $actual_output_temp_file " " $expected_output_file " > /dev/null; then
3230 pass_message " Basic copy - File content matches expected"
3937rm -f " $actual_output_temp_file "
4038
4139# Clean up the basic test file
42- python3 " $QMCTL_SCRIPT " exec bash -c " rm -f /tmp/file-to-copy.txt && echo 'cleaned up basic test file'" > /dev/null 2>&1 || true
40+ qmctl exec bash -c " rm -f /tmp/file-to-copy.txt && echo 'cleaned up basic test file'" > /dev/null 2>&1 || true
4341
4442# Function to create a unique test file with specific content
4543create_test_file () {
@@ -73,7 +71,7 @@ verify_copy_content() {
7371 if [[ " $actual_dst_path " == qm:* ]]; then
7472 # Destination is in container - use exec to read content
7573 local container_path=" ${actual_dst_path# qm: } "
76- if actual_content=$( python3 " $QMCTL_SCRIPT " exec cat " $container_path " 2> /dev/null) ; then
74+ if actual_content=$( qmctl exec cat " $container_path " 2> /dev/null) ; then
7775 # Success - continue with verification
7876 :
7977 else
@@ -115,7 +113,7 @@ test_copy_with_verification() {
115113
116114 # Run the copy command using the general run_test function
117115 if run_test " $test_name " 0 " none" " " \
118- python3 " $QMCTL_SCRIPT " cp " $src_path " " $dst_path " ; then
116+ qmctl cp " $src_path " " $dst_path " ; then
119117
120118 # If copy succeeded, verify content
121119 if verify_copy_content " $test_name " " $dst_path " " $expected_content " " $src_path " ; then
@@ -127,7 +125,7 @@ test_copy_with_verification() {
127125 if [ -n " $cleanup_paths " ]; then
128126 for cleanup_path in $cleanup_paths ; do
129127 local container_cleanup_path=" ${cleanup_path# qm: } "
130- python3 " $QMCTL_SCRIPT " exec bash -c " rm -f '$container_cleanup_path ' && echo 'cleaned up $container_cleanup_path '" > /dev/null 2>&1 || true
128+ qmctl exec bash -c " rm -f '$container_cleanup_path ' && echo 'cleaned up $container_cleanup_path '" > /dev/null 2>&1 || true
131129 done
132130 fi
133131}
@@ -148,7 +146,7 @@ test_copy_with_verification \
148146test_content_2=" Bidirectional copy test 2: container to host"
149147
150148# First, create file in container
151- python3 " $QMCTL_SCRIPT " exec bash -c " echo '$test_content_2 ' > /tmp/bidi_test2.txt && echo 'File created in container'"
149+ qmctl exec bash -c " echo '$test_content_2 ' > /tmp/bidi_test2.txt && echo 'File created in container'"
152150
153151# Then copy from container to host
154152test_file_2=" /tmp/bidi_test2_result.txt"
@@ -165,7 +163,7 @@ test_file_5=$(mktemp)
165163create_test_file " $test_file_5 " " $test_content_5 "
166164
167165# Ensure target directory exists in container
168- python3 " $QMCTL_SCRIPT " exec bash -c " mkdir -p /tmp/copy_test_dir && echo 'Directory created'"
166+ qmctl exec bash -c " mkdir -p /tmp/copy_test_dir && echo 'Directory created'"
169167
170168# When copying to a directory, the file keeps its original name
171169test_file_5_basename=$( basename " $test_file_5 " )
@@ -178,14 +176,14 @@ test_copy_with_verification \
178176
179177# The actual destination file will be at /tmp/copy_test_dir/$test_file_5_basename
180178# Clean up the file we just copied
181- python3 " $QMCTL_SCRIPT " exec bash -c " rm -f '/tmp/copy_test_dir/$test_file_5_basename ' && echo 'cleaned up test file'" > /dev/null 2>&1 || true
179+ qmctl exec bash -c " rm -f '/tmp/copy_test_dir/$test_file_5_basename ' && echo 'cleaned up test file'" > /dev/null 2>&1 || true
182180
183181# Test 6: Container directory to host
184182test_content_6=" Container directory to host test"
185183
186184# Create file in container directory
187- python3 " $QMCTL_SCRIPT " exec bash -c " mkdir -p /tmp/container_source_dir && echo 'Source directory created'"
188- python3 " $QMCTL_SCRIPT " exec bash -c " echo '$test_content_6 ' > /tmp/container_source_dir/test_file.txt && echo 'File created in container directory'"
185+ qmctl exec bash -c " mkdir -p /tmp/container_source_dir && echo 'Source directory created'"
186+ qmctl exec bash -c " echo '$test_content_6 ' > /tmp/container_source_dir/test_file.txt && echo 'File created in container directory'"
189187
190188# Create target directory on host
191189mkdir -p /tmp/host_target_dir
@@ -198,7 +196,7 @@ test_copy_with_verification \
198196 " /tmp/host_target_dir/test_file.txt"
199197
200198# Cleanup test directories
201- python3 " $QMCTL_SCRIPT " exec bash -c " rm -rf /tmp/copy_test_dir /tmp/container_source_dir && echo 'cleaned up test directories'" > /dev/null 2>&1 || true
199+ qmctl exec bash -c " rm -rf /tmp/copy_test_dir /tmp/container_source_dir && echo 'cleaned up test directories'" > /dev/null 2>&1 || true
202200rm -rf /tmp/host_target_dir 2> /dev/null || true
203201
204202# All tests passed
0 commit comments