forked from google/centipede
-
Notifications
You must be signed in to change notification settings - Fork 5
/
execution_request.h
57 lines (43 loc) · 2.18 KB
/
execution_request.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright 2022 The Centipede Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Utilities used for Centipede => Runner requests.
#ifndef THIRD_PARTY_CENTIPEDE_EXECUTION_REQUEST_H_
#define THIRD_PARTY_CENTIPEDE_EXECUTION_REQUEST_H_
#include <cstddef>
#include <vector>
#include "./defs.h"
#include "./shared_memory_blob_sequence.h"
namespace centipede::execution_request {
// Sends a request (via `blobseq`) to execute `inputs`.
// Returns the number of sent inputs, which would normally be inputs.size().
size_t RequestExecution(const std::vector<ByteArray> &inputs,
SharedMemoryBlobSequence &blobseq);
// Sends a request (via `blobseq`) to compute `num_mutants` mutants of `inputs`.
// Returns the number of sent inputs, which would normally be inputs.size().
size_t RequestMutation(size_t num_mutants, const std::vector<ByteArray> &inputs,
SharedMemoryBlobSequence &blobseq);
// Returns whether `blob` indicates an execution request.
bool IsExecutionRequest(SharedMemoryBlobSequence::Blob blob);
// Returns whether `blob` indicates a mutation request.
bool IsMutationRequest(SharedMemoryBlobSequence::Blob blob);
// Returns true and sets `num_inputs`
// iff the blob indicates the number of inputs.
bool IsNumInputs(SharedMemoryBlobSequence::Blob blob, size_t &num_inputs);
// Returns true and sets `num_mutants`
// iff the blob indicates the number of mutants.
bool IsNumMutants(SharedMemoryBlobSequence::Blob blob, size_t &num_mutants);
// Returns true iff `blob` indicates a data input.
bool IsDataInput(SharedMemoryBlobSequence::Blob blob);
} // namespace centipede::execution_request
#endif // THIRD_PARTY_CENTIPEDE_EXECUTION_REQUEST_H_