fortrangoingonforty/fgof-devloop / 9b6b6b6

Browse files

Harden devloop release edges

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
9b6b6b6012099096f2bae5100908be8cb58aefb0
Parents
85ce6c4
Tree
55b14f0

3 changed files

StatusFile+-
M src/fgof_devloop.f90 6 0
M test/test_devloop_jobs.f90 8 0
M test/test_devloop_watch.f90 7 0
src/fgof_devloop.f90modified
@@ -536,6 +536,8 @@ contains
536536
     if (present(options)) local_options = options
537537
     call normalize_options(local_options)
538538
 
539
+    if (.not. local_options%restart_on_change) return
540
+
539541
     effective_change_count = summary%change_count
540542
     if (.not. local_options%restart_on_directory_change) then
541543
       effective_change_count = summary%file_change_count
@@ -684,6 +686,10 @@ contains
684686
     if (.not. job_state%spec%enabled) return
685687
     if (.not. job_state%configured) return
686688
     if (trigger%kind == FGOF_DEVLOOP_TRIGGER_NONE) return
689
+    if (job_state%released) then
690
+      plan%reason = "job released"
691
+      return
692
+    end if
687693
 
688694
     if (job_state%terminal_handoff_required .and. job_state%spec%release_on_handoff) then
689695
       plan%should_release = .true.
test/test_devloop_jobs.f90modified
@@ -1,5 +1,6 @@
11
 program test_devloop_jobs
22
   use fgof_devloop, only : &
3
+    FGOF_DEVLOOP_JOB_ACTION_NONE, &
34
     FGOF_DEVLOOP_JOB_ACTION_RESTART, &
45
     FGOF_DEVLOOP_JOB_ACTION_START, &
56
     attach_devloop_job, &
@@ -60,6 +61,13 @@ contains
6061
     if (.not. job%released) error stop "release should mark devloop job released"
6162
     if (job%cleanup_needed) error stop "release should clear cleanup obligations"
6263
     if (.not. job%running) error stop "release should not alter runtime state"
64
+
65
+    plan = devloop_job_restart_plan(job, devloop_change_trigger(1, "source changed"))
66
+    if (plan%action /= FGOF_DEVLOOP_JOB_ACTION_NONE) error stop "released job should not plan action"
67
+    if (plan%should_stop) error stop "released job should not stop"
68
+    if (plan%should_start) error stop "released job should not start"
69
+    if (plan%should_restart) error stop "released job should not restart"
70
+    if (plan%reason /= "job released") error stop "released job reason should be explicit"
6371
   end subroutine test_service_restart_plan
6472
 
6573
   subroutine test_terminal_handoff_plan()
test/test_devloop_watch.f90modified
@@ -74,6 +74,13 @@ program test_devloop_watch
7474
   if (trigger%kind /= FGOF_DEVLOOP_TRIGGER_CHANGE) error stop "watch changes should create a change trigger"
7575
   if (trigger%change_count /= 4) error stop "watch trigger should carry the change count"
7676
 
77
+  options = clear_devloop_options()
78
+  options%restart_on_change = .false.
79
+  trigger = devloop_watch_trigger(summary, options)
80
+  if (trigger%kind /= FGOF_DEVLOOP_TRIGGER_NONE) then
81
+    error stop "restart-on-change policy should suppress watch triggers"
82
+  end if
83
+
7784
   options = clear_devloop_options()
7885
   options%restart_on_directory_change = .false.
7986
   options%min_restart_changes = 4