~geda-admins/pcb/pcb-main

« back to all changes in this revision

Viewing changes to tests/run_tests.sh

  • Committer: bert
  • Date: 2021-02-28 18:50:10 UTC
  • mfrom: (4015.1.1)
  • Revision ID: git-v1:ba295b7cd7e2dff4bd93fe5d67f327977a405b7c
Tags: v4.3.0
Merge branch 'LP1906451'

Signed-off-by: bert <bert.timmerman@xs4all.nl>

Show diffs side-by-side

added added

removed removed

Lines of Context:
447
447
 
448
448
##########################################################################
449
449
#
 
450
# BOM_MD comparison routines
 
451
#
 
452
 
 
453
# used to remove things like creation date from BOM_MD files
 
454
normalize_bom_md() {
 
455
    local f1="$1"
 
456
    local f2="$2"
 
457
    $AWK '
 
458
        /^Date:/ {print "Date: today"; next}
 
459
        /^Author:/ {print "Author: PCB"; next}
 
460
        {print}' \
 
461
        $f1 > $f2
 
462
}
 
463
 
 
464
# top level function to compare BOM_MD output
 
465
compare_bom_md() {
 
466
    local f1="$1"
 
467
    local f2="$2"
 
468
    compare_check "compare_bom_md" "$f1" "$f2" || return 1
 
469
 
 
470
    # an example BOM_MD file is:
 
471
 
 
472
    #  # PCB Bill Of Materials MarkDown Version 1.0
 
473
 
 
474
    #  Date: zo 28 feb 2021 12:13:41 GMT UTC
 
475
 
 
476
    #  Author: Bert Timmerman
 
477
 
 
478
    #  Title: Basic BOM/XY Test
 
479
 
 
480
    #  | Quantity | Description | Value | RefDes |
 
481
    #  |----------|-------------|-------|--------|
 
482
    #  | 8 | Standard SMT resistor, capacitor etc | RESC3216N | R0_BOT R90_BOT R180_BOT R270_BOT R0_TOP R270_TOP R180_TOP R90_TOP |
 
483
    #  | 8 | Small outline package, narrow (150mil) | SO8 | USO0_BOT USO90_BOT USO180_BOT USO270_BOT USO0_TOP USO270_TOP USO180_TOP USO90_TOP |
 
484
    #  | 8 | Dual in-line package, narrow (300 mil) | DIP8 | UDIP0_BOT UDIP90_BOT UDIP180_BOT UDIP270_BOT UDIP0_TOP UDIP270_TOP UDIP180_TOP UDIP90_TOP |
 
485
 
 
486
    #  For comparison, we need to ignore changes in the Date and Author lines.
 
487
    local cf1=${tmpd}/`basename $f1`-ref
 
488
    local cf2=${tmpd}/`basename $f2`-out
 
489
 
 
490
    normalize_bom_md $f1 $cf1
 
491
    normalize_bom_md $f2 $cf2
 
492
    run_diff $cf1 $cf2 || test_failed=yes
 
493
}
 
494
 
 
495
##########################################################################
 
496
#
450
497
# GCODE comparison routines
451
498
#
452
499
 
892
939
                    compare_xy ${refdir}/${fn} ${rundir}/${fn}
893
940
                    ;;
894
941
 
 
942
                # BOM_MD HID
 
943
                md)
 
944
                    compare_bom_md ${refdir}/${fn} ${rundir}/${fn}
 
945
                    ;;
 
946
 
895
947
                # GCODE HID
896
948
                gcode)
897
949
                    compare_gcode ${refdir}/${fn} ${rundir}/${fn}