MediaImporter / test_runner.sh
Newer Older
02f71bb 8 months ago History
648 lines | 19.897kb
Bogdan Timofte authored 8 months ago
1
#!/bin/bash
2

            
3
# Media Importer Test Runner
4
# Comprehensive testing framework based on Development.md specifications
5

            
6
set -e
7

            
8
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
TEST_DIR="$SCRIPT_DIR/test"
10
SOURCE_DIR="$TEST_DIR/source"
11
DEST_DIR="$TEST_DIR/destination"
12
SAMPLES_DIR="$SCRIPT_DIR/sample"  # Fixed: was 'samples' but should be 'sample'
13
MEDIA_IMPORTER="$SCRIPT_DIR/media-importer.sh"
14
TEST_REPORTS_DIR="$SCRIPT_DIR/test_reports"
15

            
16
# Colors for output
17
RED='\033[0;31m'
18
GREEN='\033[0;32m'
19
YELLOW='\033[1;33m'
20
BLUE='\033[0;34m'
21
NC='\033[0m' # No Color
22

            
23
# Function to print colored output
24
print_color() {
25
    local color="$1"
26
    local message="$2"
27
    echo -e "${color}${message}${NC}"
28
}
29

            
30
# Function to create test directories
31
create_test_dirs() {
32
    print_color "$BLUE" "Creating test directories..."
33
    mkdir -p "$SOURCE_DIR"
34
    mkdir -p "$DEST_DIR"
35
    mkdir -p "$TEST_REPORTS_DIR"
36
}
37

            
38
# Function to clean test directory
39
clean_test_dir() {
40
    print_color "$BLUE" "Cleaning test directory..."
41
    rm -rf "$TEST_DIR"/*
42
}
43

            
44
# Function to copy sample files
45
copy_sample_files() {
46
    local source_pattern="$1"
47
    local target_dir="$2"
48

            
49
    if [[ -d "$SAMPLES_DIR/$source_pattern" ]]; then
50
        # Copy all files recursively from source to target directory
51
        find "$SAMPLES_DIR/$source_pattern" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.tiff" -o -iname "*.tif" -o -iname "*.cr2" -o -iname "*.nef" -o -iname "*.arw" -o -iname "*.dng" -o -iname "*.raw" -o -iname "*.mp4" -o -iname "*.mov" -o -iname "*.avi" -o -iname "*.mts" -o -iname "*.m2ts" -o -iname "*.mkv" -o -iname "*.wmv" -o -iname "*.3gp" -o -iname "*.m4v" \) -exec cp {} "$target_dir/" \; 2>/dev/null || true
52
        print_color "$GREEN" "Copied $source_pattern files to $target_dir"
53
    else
54
        print_color "$YELLOW" "Warning: $SAMPLES_DIR/$source_pattern not found. Path: $SAMPLES_DIR/$source_pattern"
55
    fi
56
}
57

            
58
# Function to capture directory state
59
capture_state() {
60
    local dir_path="$1"
61
    local output_file="$2"
62
    local label="$3"
63

            
64
    print_color "$BLUE" "Capturing $label directory state..."
65
    if [[ -d "$dir_path" ]]; then
66
        find "$dir_path" -type f | sort > "$output_file"
67
    else
68
        echo "# Directory does not exist or is empty" > "$output_file"
69
    fi
70
}
71

            
72
# Function to run test command and capture output
73
run_test_command() {
74
    local command="$1"
75
    local log_file="$2"
76

            
77
    print_color "$YELLOW" "Executing: $command"
78
    echo "$command" > "$log_file"
79
    echo "" >> "$log_file"
80
    echo "=== SCRIPT OUTPUT ===" >> "$log_file"
81

            
82
    # Run command and capture both stdout and stderr
83
    if eval "$command" >> "$log_file" 2>&1; then
84
        echo "" >> "$log_file"
85
        echo "=== COMMAND COMPLETED SUCCESSFULLY ===" >> "$log_file"
86
        return 0
87
    else
88
        echo "" >> "$log_file"
89
        echo "=== COMMAND FAILED ===" >> "$log_file"
90
        return 1
91
    fi
92
}
93

            
94
# Function to generate test report
95
generate_test_report() {
96
    local test_name="$1"
97
    local scenario="$2"
98
    local objective="$3"
99
    local files_used="$4"
100
    local command="$5"
101
    local result_status="$6"
102

            
103
    # Determine success/failure prefix
104
    local status_prefix
105
    if [[ $result_status -eq 0 ]]; then
106
        status_prefix="s"
107
    else
108
        status_prefix="f"
109
    fi
110

            
111
    # Format date as YYYYMMDD
112
    local date_stamp=$(date '+%Y%m%d')
113

            
114
    # Create filename with new format: [s|f]_date_restul_numelei
115
    local report_file="$TEST_REPORTS_DIR/${status_prefix}_${date_stamp}_${test_name}.md"
116

            
117
    print_color "$BLUE" "Generating test report: $report_file"
118

            
119
    cat > "$report_file" << EOF
120
# Test Report: $test_name
121

            
122
## Test Information
123
- **Date**: $(date)
124
- **Scenario**: $scenario
125
- **Objective**: $objective
126
- **Files Used**: $files_used
127

            
128
## Pre-Test State
129
### Source Directory Structure
130
\`\`\`
131
$(cat "$TEST_DIR/source_before.txt" 2>/dev/null || echo "# No pre-test source state captured")
132
\`\`\`
133

            
134
### Destination Directory Structure
135
\`\`\`
136
$(cat "$TEST_DIR/dest_before.txt" 2>/dev/null || echo "# No pre-test destination state captured")
137
\`\`\`
138

            
139
## Test Execution
140
### Command Used
141
\`\`\`bash
142
$command
143
\`\`\`
144

            
145
### Script Output
146
\`\`\`
147
$(cat "$TEST_DIR/import_log.txt" 2>/dev/null || echo "# No script output captured")
148
\`\`\`
149

            
150
## Post-Test State
151
### Source Directory Structure
152
\`\`\`
153
$(cat "$TEST_DIR/source_after.txt" 2>/dev/null || echo "# No post-test source state captured")
154
\`\`\`
155

            
156
### Destination Directory Structure
157
\`\`\`
158
$(cat "$TEST_DIR/dest_after.txt" 2>/dev/null || echo "# No post-test destination state captured")
159
\`\`\`
160

            
161
## Analysis and Verification
162
### Expected Results
163
- Files should be processed according to the test scenario
164
- No data loss should occur
165
- Proper error handling for edge cases
166

            
167
### Actual Results
168
- Test execution completed with status: $result_status
169

            
170
### Issues Found
171
- [ ] No issues detected
172
- [ ] Issues found (see notes below)
173

            
174
### Protections Verified
175
- [ ] Destination exclusion working
176
- [ ] Move confirmation functional
177
- [ ] No data loss detected
178
- [ ] UTC conversion correct (for QuickTime files)
179
- [ ] Unimportable files handling (if applicable)
180

            
181
## Conclusion
182
### Test Result
183
- [ ] PASSED
184
- [ ] FAILED
185
- [ ] PARTIAL (with notes)
186

            
187
### Notes
188
Test completed as per Development.md specifications.
189

            
190
### Files Generated
191
- \`test/source_before.txt\` - Pre-test source structure
192
- \`test/dest_before.txt\` - Pre-test destination structure
193
- \`test/source_after.txt\` - Post-test source structure
194
- \`test/dest_after.txt\` - Post-test destination structure
195
- \`test/import_log.txt\` - Full script execution log
196
- \`test/test_report.md\` - This report
197
EOF
198

            
199
    print_color "$GREEN" "Test report generated: $report_file"
200

            
201
    # Clean up old reports, keeping only the last 10
202
    cleanup_old_reports
203
}
204

            
205
# Function to clean up old test reports, keeping only the last 10
206
cleanup_old_reports() {
207
    if [[ -d "$TEST_REPORTS_DIR" ]]; then
208
        # Count total reports
209
        local total_reports=$(find "$TEST_REPORTS_DIR" -name "*.md" | wc -l)
210

            
211
        if [[ $total_reports -gt 10 ]]; then
212
            print_color "$BLUE" "Cleaning up old test reports (keeping last 10)..."
213

            
214
            # Find and remove oldest reports, keeping the 10 most recent
215
            find "$TEST_REPORTS_DIR" -name "*.md" -type f -printf '%T@ %p\n' | \
216
                sort -n | \
217
                head -n -$((10)) | \
218
                cut -d' ' -f2- | \
219
                xargs -r rm
220

            
221
            local remaining=$(find "$TEST_REPORTS_DIR" -name "*.md" | wc -l)
222
            print_color "$GREEN" "Kept $remaining most recent test reports"
223
        fi
224
    fi
225
}
226

            
227
# Test Case 0: Basic Functionality Test
228
run_basic_functionality_test() {
229
    print_color "$GREEN" "=== Running Test 0: Basic Functionality Test ==="
230

            
231
    clean_test_dir
232
    create_test_dirs
233

            
234
    # Setup test files
235
    copy_sample_files "media/sortable" "$SOURCE_DIR"
236

            
237
    # Capture pre-test state
238
    capture_state "$SOURCE_DIR" "$TEST_DIR/source_before.txt" "source"
239
    capture_state "$DEST_DIR" "$TEST_DIR/dest_before.txt" "destination"
240

            
241
    # Run test
242
    local command="\"$MEDIA_IMPORTER\" -s \"$SOURCE_DIR\" -d \"$DEST_DIR\" -v"
243
    local result=0
244
    run_test_command "$command" "$TEST_DIR/import_log.txt" || result=$?
245

            
246
    # Capture post-test state
247
    capture_state "$SOURCE_DIR" "$TEST_DIR/source_after.txt" "source"
248
    capture_state "$DEST_DIR" "$TEST_DIR/dest_after.txt" "destination"
249

            
250
    # Generate report
251
    generate_test_report \
252
        "Basic_Functionality" \
253
        "Processing files with valid EXIF data" \
254
        "Verify correct sorting and organization of media files" \
255
        "Sample media files with EXIF data from samples/media/sortable/" \
256
        "$command" \
257
        "$result"
258
}
259

            
260
# Test Case 1: Unimportable Files Test
261
run_unimportable_files_test() {
262
    print_color "$GREEN" "=== Running Test 1: Unimportable Files Test ==="
263

            
264
    clean_test_dir
265
    create_test_dirs
266

            
267
    # Setup test files - mix of sortable and unimportable
268
    copy_sample_files "media/sortable" "$SOURCE_DIR"
269
    copy_sample_files "media/unimportable" "$SOURCE_DIR"
270

            
271
    # Capture pre-test state
272
    capture_state "$SOURCE_DIR" "$TEST_DIR/source_before.txt" "source"
273
    capture_state "$DEST_DIR" "$TEST_DIR/dest_before.txt" "destination"
274

            
275
    # Run test (without --collect-unimportable flag)
276
    local command="\"$MEDIA_IMPORTER\" -s \"$SOURCE_DIR\" -d \"$DEST_DIR\" -v"
277
    local result=0
278
    run_test_command "$command" "$TEST_DIR/import_log.txt" || result=$?
279

            
280
    # Capture post-test state
281
    capture_state "$SOURCE_DIR" "$TEST_DIR/source_after.txt" "source"
282
    capture_state "$DEST_DIR" "$TEST_DIR/dest_after.txt" "destination"
283

            
284
    # Generate report
285
    generate_test_report \
286
        "Unimportable_Files_Handling" \
287
        "Testing files without EXIF data in root and subfolders" \
288
        "Verify proper handling of unimportable files without collection flag" \
289
        "Mixed sortable and unimportable files from samples/media/" \
290
        "$command" \
291
        "$result"
292
}
293

            
294
# Test Case 2: Mixed Content Test
295
run_mixed_content_test() {
296
    print_color "$GREEN" "=== Running Test 2: Mixed Content Test ==="
297

            
298
    clean_test_dir
299
    create_test_dirs
300

            
301
    # Setup separate folders for sortable vs unimportable
302
    mkdir -p "$SOURCE_DIR/sortable" "$SOURCE_DIR/unimportable"
303
    copy_sample_files "media/sortable" "$SOURCE_DIR/sortable"
304
    copy_sample_files "media/unimportable" "$SOURCE_DIR/unimportable"
305

            
306
    # Capture pre-test state
307
    capture_state "$SOURCE_DIR" "$TEST_DIR/source_before.txt" "source"
308
    capture_state "$DEST_DIR" "$TEST_DIR/dest_before.txt" "destination"
309

            
310
    # Run test
311
    local command="\"$MEDIA_IMPORTER\" -s \"$SOURCE_DIR\" -d \"$DEST_DIR\" -v"
312
    local result=0
313
    run_test_command "$command" "$TEST_DIR/import_log.txt" || result=$?
314

            
315
    # Capture post-test state
316
    capture_state "$SOURCE_DIR" "$TEST_DIR/source_after.txt" "source"
317
    capture_state "$DEST_DIR" "$TEST_DIR/dest_after.txt" "destination"
318

            
319
    # Generate report
320
    generate_test_report \
321
        "Mixed_Content" \
322
        "Processing sortable and unimportable files in separate folders" \
323
        "Verify cleanup behavior for folders with different file types" \
324
        "Separate folders: sortable/ and unimportable/ with respective file types" \
325
        "$command" \
326
        "$result"
327
}
328

            
329
# Test Case 3: Safety Protections Test
330
run_safety_protections_test() {
331
    print_color "$GREEN" "=== Running Test 3: Safety Protections Test ==="
332

            
333
    clean_test_dir
334
    create_test_dirs
335

            
336
    # Setup test files
337
    copy_sample_files "media/sortable" "$SOURCE_DIR"
338

            
339
    # Create a file in destination to test exclusion
340
    echo "test file" > "$DEST_DIR/test.txt"
341

            
342
    # Capture pre-test state
343
    capture_state "$SOURCE_DIR" "$TEST_DIR/source_before.txt" "source"
344
    capture_state "$DEST_DIR" "$TEST_DIR/dest_before.txt" "destination"
345

            
346
    # Run test
347
    local command="\"$MEDIA_IMPORTER\" -s \"$SOURCE_DIR\" -d \"$DEST_DIR\" -v"
348
    local result=0
349
    run_test_command "$command" "$TEST_DIR/import_log.txt" || result=$?
350

            
351
    # Capture post-test state
352
    capture_state "$SOURCE_DIR" "$TEST_DIR/source_after.txt" "source"
353
    capture_state "$DEST_DIR" "$TEST_DIR/dest_after.txt" "destination"
354

            
355
    # Generate report
356
    generate_test_report \
357
        "Safety_Protections" \
358
        "Testing destination exclusion and move confirmation" \
359
        "Verify data integrity protections prevent data loss" \
360
        "Sample files with pre-existing destination content" \
361
        "$command" \
362
        "$result"
363
}
364

            
365
# Test Case 4: UTC Conversion Test
366
run_utc_conversion_test() {
367
    print_color "$GREEN" "=== Running Test 4: UTC Conversion Test ==="
368

            
369
    clean_test_dir
370
    create_test_dirs
371

            
372
    # Setup test files (assuming QuickTime files are available)
373
    copy_sample_files "media/sortable" "$SOURCE_DIR"
374

            
375
    # Capture pre-test state
376
    capture_state "$SOURCE_DIR" "$TEST_DIR/source_before.txt" "source"
377
    capture_state "$DEST_DIR" "$TEST_DIR/dest_before.txt" "destination"
378

            
379
    # Run test
380
    local command="\"$MEDIA_IMPORTER\" -s \"$SOURCE_DIR\" -d \"$DEST_DIR\" -v"
381
    local result=0
382
    run_test_command "$command" "$TEST_DIR/import_log.txt" || result=$?
383

            
384
    # Capture post-test state
385
    capture_state "$SOURCE_DIR" "$TEST_DIR/source_after.txt" "source"
386
    capture_state "$DEST_DIR" "$TEST_DIR/dest_after.txt" "destination"
387

            
388
    # Generate report
389
    generate_test_report \
390
        "UTC_Conversion" \
391
        "Testing UTC timestamp conversion for QuickTime files" \
392
        "Verify correct UTC to local time conversion" \
393
        "QuickTime/Apple media files with UTC timestamps" \
394
        "$command" \
395
        "$result"
396
}
397

            
398
# Test Case 5: Subdirectory Processing Test
399
run_subdirectory_processing_test() {
400
    print_color "$GREEN" "=== Running Test 5: Subdirectory Processing Test ==="
401

            
402
    clean_test_dir
403
    create_test_dirs
404

            
405
    # Create nested directory structure
406
    mkdir -p "$SOURCE_DIR/level1/level2"
407
    copy_sample_files "media/sortable" "$SOURCE_DIR/level1/level2"
408

            
409
    # Capture pre-test state
410
    capture_state "$SOURCE_DIR" "$TEST_DIR/source_before.txt" "source"
411
    capture_state "$DEST_DIR" "$TEST_DIR/dest_before.txt" "destination"
412

            
413
    # Run test
414
    local command="\"$MEDIA_IMPORTER\" -s \"$SOURCE_DIR\" -d \"$DEST_DIR\" -v"
415
    local result=0
416
    run_test_command "$command" "$TEST_DIR/import_log.txt" || result=$?
417

            
418
    # Capture post-test state
419
    capture_state "$SOURCE_DIR" "$TEST_DIR/source_after.txt" "source"
420
    capture_state "$DEST_DIR" "$TEST_DIR/dest_after.txt" "destination"
421

            
422
    # Generate report
423
    generate_test_report \
424
        "Subdirectory_Processing" \
425
        "Testing processing of files in nested subdirectories" \
426
        "Verify recursive file discovery and processing" \
427
        "Files in nested directory structure (level1/level2/)" \
428
        "$command" \
429
        "$result"
430
}
431

            
432
# Test Case 6: Keep Empty Directories Test
433
run_keep_empty_dirs_test() {
434
    print_color "$GREEN" "=== Running Test 6: Keep Empty Directories Test ==="
435

            
436
    clean_test_dir
437
    create_test_dirs
438

            
439
    # Create directory structure with some empty dirs
440
    mkdir -p "$SOURCE_DIR/sortable" "$SOURCE_DIR/empty1" "$SOURCE_DIR/empty2"
441
    copy_sample_files "media/sortable" "$SOURCE_DIR/sortable"
442

            
443
    # Capture pre-test state
444
    capture_state "$SOURCE_DIR" "$TEST_DIR/source_before.txt" "source"
445
    capture_state "$DEST_DIR" "$TEST_DIR/dest_before.txt" "destination"
446

            
447
    # Run test with --keep-empty-dirs
448
    local command="\"$MEDIA_IMPORTER\" -s \"$SOURCE_DIR\" -d \"$DEST_DIR\" --keep-empty-dirs -v"
449
    local result=0
450
    run_test_command "$command" "$TEST_DIR/import_log.txt" || result=$?
451

            
452
    # Capture post-test state
453
    capture_state "$SOURCE_DIR" "$TEST_DIR/source_after.txt" "source"
454
    capture_state "$DEST_DIR" "$TEST_DIR/dest_after.txt" "destination"
455

            
456
    # Generate report
457
    generate_test_report \
458
        "Keep_Empty_Directories" \
459
        "Testing --keep-empty-dirs functionality" \
460
        "Verify empty directory preservation when flag is used" \
461
        "Directory structure with sortable files and empty directories" \
462
        "$command" \
463
        "$result"
464
}
465

            
466
# Test Case 7: Source Only Test
467
run_source_only_test() {
468
    print_color "$GREEN" "=== Running Test 7: Source Only Test ==="
469

            
470
    clean_test_dir
471
    create_test_dirs
472

            
473
    # Setup test files
474
    copy_sample_files "media/sortable" "$SOURCE_DIR"
475

            
476
    # Capture pre-test state
477
    capture_state "$SOURCE_DIR" "$TEST_DIR/source_before.txt" "source"
478
    capture_state "$SOURCE_DIR/sorted" "$TEST_DIR/dest_before.txt" "auto-destination"
479

            
480
    # Run test with only source parameter
481
    local command="\"$MEDIA_IMPORTER\" -s \"$SOURCE_DIR\" -v"
482
    local result=0
483
    run_test_command "$command" "$TEST_DIR/import_log.txt" || result=$?
484

            
485
    # Capture post-test state
486
    capture_state "$SOURCE_DIR" "$TEST_DIR/source_after.txt" "source"
487
    capture_state "$SOURCE_DIR/sorted" "$TEST_DIR/dest_after.txt" "auto-destination"
488

            
489
    # Generate report
490
    generate_test_report \
491
        "Source_Only_Test" \
492
        "Testing processing with only source parameter" \
493
        "Verify automatic creation of sorted subdirectory" \
494
        "Sample media files, no explicit destination specified" \
495
        "$command" \
496
        "$result"
497
}
498

            
499
# Function to show menu
500
show_menu() {
501
    echo ""
502
    print_color "$GREEN" "Media Importer Test Runner"
503
    echo "=========================="
504
    echo ""
505
    echo "Available Tests:"
506
    echo "0. Basic Functionality Test"
507
    echo "1. Unimportable Files Test"
508
    echo "2. Mixed Content Test"
509
    echo "3. Safety Protections Test"
510
    echo "4. UTC Conversion Test"
511
    echo "5. Subdirectory Processing Test"
512
    echo "6. Keep Empty Directories Test"
513
    echo "7. Source Only Test"
514
    echo "8. Run All Tests"
515
    echo "q. Quit"
516
    echo ""
517
    echo -n "Select test to run (0-8, q to quit): "
518
}
519

            
520
# Function to run all tests
521
run_all_tests() {
522
    print_color "$GREEN" "Running all tests sequentially..."
523

            
524
    run_basic_functionality_test
525
    echo ""
526
    run_unimportable_files_test
527
    echo ""
528
    run_mixed_content_test
529
    echo ""
530
    run_safety_protections_test
531
    echo ""
532
    run_utc_conversion_test
533
    echo ""
534
    run_subdirectory_processing_test
535
    echo ""
536
    run_keep_empty_dirs_test
537
    echo ""
538
    run_source_only_test
539

            
540
    print_color "$GREEN" "All tests completed!"
541
}
542

            
543
# Main menu loop
544
main() {
545
    while true; do
546
        show_menu
547
        read -r choice
548

            
549
        case $choice in
550
            0)
551
                run_basic_functionality_test
552
                ;;
553
            1)
554
                run_unimportable_files_test
555
                ;;
556
            2)
557
                run_mixed_content_test
558
                ;;
559
            3)
560
                run_safety_protections_test
561
                ;;
562
            4)
563
                run_utc_conversion_test
564
                ;;
565
            5)
566
                run_subdirectory_processing_test
567
                ;;
568
            6)
569
                run_keep_empty_dirs_test
570
                ;;
571
            7)
572
                run_source_only_test
573
                ;;
574
            8)
575
                run_all_tests
576
                ;;
577
            q|Q)
578
                print_color "$GREEN" "Exiting test runner."
579
                exit 0
580
                ;;
581
            *)
582
                print_color "$RED" "Invalid choice. Please select 0-8 or q to quit."
583
                ;;
584
        esac
585

            
586
        echo ""
587
        echo -n "Press Enter to continue..."
588
        read -r
589
    done
590
}
591

            
592
# Check if script exists
593
if [[ ! -f "$MEDIA_IMPORTER" ]]; then
594
    print_color "$RED" "Error: $MEDIA_IMPORTER not found!"
595
    exit 1
596
fi
597

            
598
# Check if samples directory exists
599
if [[ ! -d "$SAMPLES_DIR" ]]; then
600
    print_color "$YELLOW" "Warning: $SAMPLES_DIR not found. Some tests may not work properly."
601
fi
602

            
603
# Run main menu if no arguments provided
604
if [[ $# -eq 0 ]]; then
605
    main
606
else
607
    # Handle command line arguments
608
    case "$1" in
609
        "basic"|"0")
610
            run_basic_functionality_test
611
            ;;
612
        "unimportable"|"1")
613
            run_unimportable_files_test
614
            ;;
615
        "mixed"|"2")
616
            run_mixed_content_test
617
            ;;
618
        "safety"|"3")
619
            run_safety_protections_test
620
            ;;
621
        "utc"|"4")
622
            run_utc_conversion_test
623
            ;;
624
        "subdir"|"5")
625
            run_subdirectory_processing_test
626
            ;;
627
        "keep-empty"|"6")
628
            run_keep_empty_dirs_test
629
            ;;
630
        "source-only"|"7")
631
            run_source_only_test
632
            ;;
633
        "all"|"8")
634
            run_all_tests
635
            ;;
636
        "clean")
637
            clean_test_dir
638
            ;;
639
        "setup")
640
            create_test_dirs
641
            ;;
642
        *)
643
            print_color "$RED" "Unknown test: $1"
644
            echo "Usage: $0 [basic|unimportable|mixed|safety|utc|subdir|keep-empty|source-only|all|clean|setup] or [0-8]"
645
            exit 1
646
            ;;
647
    esac
648
fi