Skip to content
Snippets Groups Projects
Commit 03e8894f authored by Andrea Michelotti's avatar Andrea Michelotti
Browse files

waitoncommand promoted, common to all SC interfaces, chaos clean cleans also default

parent dfb76c05
No related branches found
No related tags found
No related merge requests found
...@@ -333,3 +333,40 @@ void SCAbstractControlUnit::installCommand(boost::shared_ptr<BatchCommandDescrip ...@@ -333,3 +333,40 @@ void SCAbstractControlUnit::installCommand(boost::shared_ptr<BatchCommandDescrip
sandbox); sandbox);
} }
} }
bool SCAbstractControlUnit::waitOnCommandID(uint64_t& cmd_id) {
std::auto_ptr<CommandState> cmd_state;
do {
cmd_state = getStateForCommandID(cmd_id);
if (!cmd_state.get()) break;
switch (cmd_state->last_event) {
case BatchCommandEventType::EVT_QUEUED:
SCACU_LDBG_ << cmd_id << " -> QUEUED";
break;
case BatchCommandEventType::EVT_RUNNING:
SCACU_LDBG_ << cmd_id << " -> RUNNING";
break;
case BatchCommandEventType::EVT_WAITING:
SCACU_LDBG_ << cmd_id << " -> WAITING";
break;
case BatchCommandEventType::EVT_PAUSED:
SCACU_LDBG_ << cmd_id << " -> PAUSED";
break;
case BatchCommandEventType::EVT_KILLED:
SCACU_LDBG_ << cmd_id << " -> KILLED";
break;
case BatchCommandEventType::EVT_COMPLETED:
SCACU_LDBG_ << cmd_id << " -> COMPLETED";
break;
case BatchCommandEventType::EVT_FAULT:
SCACU_LDBG_ << cmd_id << " -> FAULT";
break;
}
//whait some times
usleep(500000);
} while (cmd_state->last_event != BatchCommandEventType::EVT_COMPLETED &&
cmd_state->last_event != BatchCommandEventType::EVT_FAULT &&
cmd_state->last_event != BatchCommandEventType::EVT_KILLED);
return (cmd_state.get() &&
cmd_state->last_event == BatchCommandEventType::EVT_COMPLETED);
}
...@@ -162,6 +162,8 @@ namespace chaos { ...@@ -162,6 +162,8 @@ namespace chaos {
bool is_default = false, bool is_default = false,
bool sticky = true, bool sticky = true,
unsigned int sandbox = 0); unsigned int sandbox = 0);
bool waitOnCommandID(uint64_t& cmd_id);
}; };
} }
} }
......
...@@ -22,7 +22,8 @@ if [ -n "$CHAOS_TARGET" ];then ...@@ -22,7 +22,8 @@ if [ -n "$CHAOS_TARGET" ];then
cleandir $chaos_bundle/build-${CHAOS_TARGET} cleandir $chaos_bundle/build-${CHAOS_TARGET}
else else
cleandir $chaos_bundle/chaosframwork/external-$sys-$mac cleandir $chaos_bundle/chaosframwork/external-$sys-$mac
cleandir $chaos_bundle/build-$sys-$mac cleandir $chaos_bundle/build-$sys-$mac
cleandir $chaos_bundle/chaosframework/chaos-distrib-$sys-$mac
fi fi
cleandir $chaos_bundle/chaosframwork/usr cleandir $chaos_bundle/chaosframwork/usr
cleandir $chaos_bundle/chaosframework/bin cleandir $chaos_bundle/chaosframework/bin
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment