Browse Source

Re-introduce session id

Alois Mahdal 6 years ago
parent
commit
388fd1c7ce

+ 17
- 0
src/jat.sh.skel View File

276
         msgs+=("fatal: $msg")
276
         msgs+=("fatal: $msg")
277
     done
277
     done
278
     jat__log_error "${msgs[@]}"
278
     jat__log_error "${msgs[@]}"
279
+    jat__sfinish
279
     die "${msgs[@]}"
280
     die "${msgs[@]}"
280
 }
281
 }
281
 
282
 
624
     local reload=false
625
     local reload=false
625
     local old_test_id
626
     local old_test_id
626
     local old_test_version
627
     local old_test_version
628
+    local sessid
627
     mkdir -p "$JAT__DIR" \
629
     mkdir -p "$JAT__DIR" \
628
      || die "could not initialize JAT__DIR: $JAT__DIR"
630
      || die "could not initialize JAT__DIR: $JAT__DIR"
629
     __JAT__SDIR=$JAT__DIR/session
631
     __JAT__SDIR=$JAT__DIR/session
634
     export JAT__YLOG
636
     export JAT__YLOG
635
     debug -v reload __JAT__SDIR
637
     debug -v reload __JAT__SDIR
636
     if $reload; then
638
     if $reload; then
639
+        sessid=$(__jat__sd_keyr sessid)
637
         old_test_id=$(__jat__sd_keyr test_id)
640
         old_test_id=$(__jat__sd_keyr test_id)
638
         old_test_version=$(__jat__sd_keyr test_version)
641
         old_test_version=$(__jat__sd_keyr test_version)
639
         test "$old_test_id" == "$JAT__TEST_ID" || {
642
         test "$old_test_id" == "$JAT__TEST_ID" || {
649
             "JAT__VERSION=$__JAT__SELF_VERSION"
652
             "JAT__VERSION=$__JAT__SELF_VERSION"
650
         __jat__show_sinitr
653
         __jat__show_sinitr
651
     else
654
     else
655
+        sessid=$(__jat__newsid)
652
         debug -v __JAT__SDIR JAT__YLOG
656
         debug -v __JAT__SDIR JAT__YLOG
653
         {
657
         {
654
             echo "---"
658
             echo "---"
658
             echo "    id: $JAT__TEST_ID"
662
             echo "    id: $JAT__TEST_ID"
659
             echo "    version: $JAT__TEST_VERSION"
663
             echo "    version: $JAT__TEST_VERSION"
660
             echo "start: $(__jat__newstamp)"
664
             echo "start: $(__jat__newstamp)"
665
+            echo "id: $sessid"
661
             echo "events:"
666
             echo "events:"
662
         } | __jat__writelog
667
         } | __jat__writelog
668
+        __jat__sd_keyw sessid "$sessid"
663
         __jat__sd_keyw test_id "$JAT__TEST_ID"
669
         __jat__sd_keyw test_id "$JAT__TEST_ID"
664
         __jat__sd_keyw test_version "$JAT__TEST_VERSION"
670
         __jat__sd_keyw test_version "$JAT__TEST_VERSION"
665
         __jat__pdummy
671
         __jat__pdummy
973
     esac
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
 __jat__pdummy() {
993
 __jat__pdummy() {
977
     #
994
     #
978
     # Create dummy phase
995
     # Create dummy phase

+ 1
- 0
tests/basic/oracle/ylog_both.stdout View File

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

+ 1
- 0
tests/basic/oracle/ylog_fail.stdout View File

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

+ 1
- 0
tests/basic/oracle/ylog_pass.stdout View File

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