Pārlūkot izejas kodu

Re-introduce session id

Alois Mahdal 6 gadus atpakaļ
vecāks
revīzija
388fd1c7ce

+ 17
- 0
src/jat.sh.skel Parādīt failu

@@ -276,6 +276,7 @@ jat__die() {
276 276
         msgs+=("fatal: $msg")
277 277
     done
278 278
     jat__log_error "${msgs[@]}"
279
+    jat__sfinish
279 280
     die "${msgs[@]}"
280 281
 }
281 282
 
@@ -624,6 +625,7 @@ jat__sinit() {
624 625
     local reload=false
625 626
     local old_test_id
626 627
     local old_test_version
628
+    local sessid
627 629
     mkdir -p "$JAT__DIR" \
628 630
      || die "could not initialize JAT__DIR: $JAT__DIR"
629 631
     __JAT__SDIR=$JAT__DIR/session
@@ -634,6 +636,7 @@ jat__sinit() {
634 636
     export JAT__YLOG
635 637
     debug -v reload __JAT__SDIR
636 638
     if $reload; then
639
+        sessid=$(__jat__sd_keyr sessid)
637 640
         old_test_id=$(__jat__sd_keyr test_id)
638 641
         old_test_version=$(__jat__sd_keyr test_version)
639 642
         test "$old_test_id" == "$JAT__TEST_ID" || {
@@ -649,6 +652,7 @@ jat__sinit() {
649 652
             "JAT__VERSION=$__JAT__SELF_VERSION"
650 653
         __jat__show_sinitr
651 654
     else
655
+        sessid=$(__jat__newsid)
652 656
         debug -v __JAT__SDIR JAT__YLOG
653 657
         {
654 658
             echo "---"
@@ -658,8 +662,10 @@ jat__sinit() {
658 662
             echo "    id: $JAT__TEST_ID"
659 663
             echo "    version: $JAT__TEST_VERSION"
660 664
             echo "start: $(__jat__newstamp)"
665
+            echo "id: $sessid"
661 666
             echo "events:"
662 667
         } | __jat__writelog
668
+        __jat__sd_keyw sessid "$sessid"
663 669
         __jat__sd_keyw test_id "$JAT__TEST_ID"
664 670
         __jat__sd_keyw test_version "$JAT__TEST_VERSION"
665 671
         __jat__pdummy
@@ -973,6 +979,17 @@ __jat__newstamp() {
973 979
     esac
974 980
 }
975 981
 
982
+__jat__newsid() {
983
+    #
984
+    # Create new timestamp
985
+    #
986
+    case $__JAT__DETERMINISTIC in
987
+        true)   echo noid ;;
988
+        false)  date +%s-%N ;;
989
+        *) die "bad value of __JAT__DETERMINISTIC: $__JAT__DETERMINISTIC" ;;
990
+    esac
991
+}
992
+
976 993
 __jat__pdummy() {
977 994
     #
978 995
     # Create dummy phase

+ 1
- 0
tests/basic/oracle/ylog_both.stdout Parādīt failu

@@ -5,6 +5,7 @@ test:
5 5
     id: _jat_anon_test_
6 6
     version: _jat_no_test_version_
7 7
 start: time-1
8
+id: noid
8 9
 events:
9 10
     -
10 11
         etype: SESSION.START

+ 1
- 0
tests/basic/oracle/ylog_fail.stdout Parādīt failu

@@ -5,6 +5,7 @@ test:
5 5
     id: _jat_anon_test_
6 6
     version: _jat_no_test_version_
7 7
 start: time-1
8
+id: noid
8 9
 events:
9 10
     -
10 11
         etype: SESSION.START

+ 1
- 0
tests/basic/oracle/ylog_pass.stdout Parādīt failu

@@ -5,6 +5,7 @@ test:
5 5
     id: _jat_anon_test_
6 6
     version: _jat_no_test_version_
7 7
 start: time-1
8
+id: noid
8 9
 events:
9 10
     -
10 11
         etype: SESSION.START