Don't call function in assert (#19997)
parent
fd01c89491
commit
91504176e4
|
@ -156,7 +156,8 @@ void * run_spinner(void * args) {
|
|||
|
||||
int main() {
|
||||
pthread_t spinner_thread;
|
||||
assert(pthread_create(&spinner_thread, NULL, run_spinner, NULL) == 0);
|
||||
int err = pthread_create(&spinner_thread, NULL, run_spinner, NULL);
|
||||
assert(err == 0);
|
||||
|
||||
int status = do_install();
|
||||
|
||||
|
|
|
@ -132,8 +132,10 @@ void TTYPigeon::connect(const char * tty) {
|
|||
if (pigeon_tty_fd < 0){
|
||||
handle_tty_issue(errno, __func__);
|
||||
assert(pigeon_tty_fd >= 0);
|
||||
|
||||
}
|
||||
assert(tcgetattr(pigeon_tty_fd, &pigeon_tty) == 0);
|
||||
int err = tcgetattr(pigeon_tty_fd, &pigeon_tty);
|
||||
assert(err == 0);
|
||||
|
||||
// configure tty
|
||||
pigeon_tty.c_cflag &= ~PARENB; // disable parity
|
||||
|
@ -152,7 +154,8 @@ void TTYPigeon::connect(const char * tty) {
|
|||
pigeon_tty.c_cc[VMIN] = 0; // min amount of characters returned
|
||||
pigeon_tty.c_cc[VTIME] = 0; // max blocking time in s/10 (0=inf)
|
||||
|
||||
assert(tcsetattr(pigeon_tty_fd, TCSANOW, &pigeon_tty) == 0);
|
||||
err = tcsetattr(pigeon_tty_fd, TCSANOW, &pigeon_tty);
|
||||
assert(err == 0);
|
||||
}
|
||||
|
||||
void TTYPigeon::set_baud(int baud){
|
||||
|
@ -169,15 +172,20 @@ void TTYPigeon::set_baud(int baud){
|
|||
}
|
||||
|
||||
// make sure everything is tx'ed before changing baud
|
||||
assert(tcdrain(pigeon_tty_fd) == 0);
|
||||
int err = tcdrain(pigeon_tty_fd);
|
||||
assert(err == 0);
|
||||
|
||||
// change baud
|
||||
assert(tcgetattr(pigeon_tty_fd, &pigeon_tty) == 0);
|
||||
assert(cfsetspeed(&pigeon_tty, baud_const) == 0);
|
||||
assert(tcsetattr(pigeon_tty_fd, TCSANOW, &pigeon_tty) == 0);
|
||||
err = tcgetattr(pigeon_tty_fd, &pigeon_tty);
|
||||
assert(err == 0);
|
||||
err = cfsetspeed(&pigeon_tty, baud_const);
|
||||
assert(err == 0);
|
||||
err = tcsetattr(pigeon_tty_fd, TCSANOW, &pigeon_tty);
|
||||
assert(err == 0);
|
||||
|
||||
// flush
|
||||
assert(tcflush(pigeon_tty_fd, TCIOFLUSH) == 0);
|
||||
err = tcflush(pigeon_tty_fd, TCIOFLUSH);
|
||||
assert(err == 0);
|
||||
}
|
||||
|
||||
void TTYPigeon::send(const std::string &s) {
|
||||
|
|
|
@ -17,25 +17,27 @@ int main(int argc, char *argv[]) {
|
|||
PubMaster pm({"androidLog"});
|
||||
|
||||
sd_journal *journal;
|
||||
assert(sd_journal_open(&journal, 0) >= 0);
|
||||
assert(sd_journal_get_fd(journal) >= 0); // needed so sd_journal_wait() works properly if files rotate
|
||||
assert(sd_journal_seek_tail(journal) >= 0);
|
||||
int err = sd_journal_open(&journal, 0);
|
||||
assert(err >= 0);
|
||||
err = sd_journal_get_fd(journal); // needed so sd_journal_wait() works properly if files rotate
|
||||
assert(err >= 0);
|
||||
err = sd_journal_seek_tail(journal);
|
||||
assert(err >= 0);
|
||||
|
||||
int r;
|
||||
while (!do_exit) {
|
||||
r = sd_journal_next(journal);
|
||||
assert(r >= 0);
|
||||
err = sd_journal_next(journal);
|
||||
assert(err >= 0);
|
||||
|
||||
// Wait for new message if we didn't receive anything
|
||||
if (r == 0){
|
||||
r = sd_journal_wait(journal, 1000 * 1000);
|
||||
assert (r >= 0);
|
||||
if (err == 0){
|
||||
err = sd_journal_wait(journal, 1000 * 1000);
|
||||
assert (err >= 0);
|
||||
continue; // Try again
|
||||
}
|
||||
|
||||
uint64_t timestamp = 0;
|
||||
r = sd_journal_get_realtime_usec(journal, ×tamp);
|
||||
assert(r >= 0);
|
||||
err = sd_journal_get_realtime_usec(journal, ×tamp);
|
||||
assert(err >= 0);
|
||||
|
||||
const void *data;
|
||||
size_t length;
|
||||
|
|
|
@ -22,8 +22,10 @@ ONNXModel::ONNXModel(const char *path, float *_output, size_t _output_size, int
|
|||
strcat(tmp, ".onnx");
|
||||
LOGD("loading model %s", tmp);
|
||||
|
||||
assert(pipe(pipein) == 0);
|
||||
assert(pipe(pipeout) == 0);
|
||||
int err = pipe(pipein);
|
||||
assert(err == 0);
|
||||
err = pipe(pipeout);
|
||||
assert(err == 0);
|
||||
|
||||
std::string exe_dir = util::dir_name(util::readlink("/proc/self/exe"));
|
||||
std::string onnx_runner = exe_dir + "/runners/onnx_runner.py";
|
||||
|
|
|
@ -140,7 +140,8 @@ void SNPEModel::execute(float *net_input_buf, int buf_size) {
|
|||
if (Runtime == zdl::DlSystem::Runtime_t::GPU) {
|
||||
float *inputs[4] = {recurrent, trafficConvention, desire, net_input_buf};
|
||||
if (thneed == NULL) {
|
||||
assert(inputBuffer->setBufferAddress(net_input_buf));
|
||||
bool ret = inputBuffer->setBufferAddress(net_input_buf);
|
||||
assert(ret == true);
|
||||
if (!snpe->execute(inputMap, outputMap)) {
|
||||
PrintErrorStringAndExit();
|
||||
}
|
||||
|
@ -173,7 +174,8 @@ void SNPEModel::execute(float *net_input_buf, int buf_size) {
|
|||
}
|
||||
} else {
|
||||
#endif
|
||||
assert(inputBuffer->setBufferAddress(net_input_buf));
|
||||
bool ret = inputBuffer->setBufferAddress(net_input_buf);
|
||||
assert(ret == true);
|
||||
if (!snpe->execute(inputMap, outputMap)) {
|
||||
PrintErrorStringAndExit();
|
||||
}
|
||||
|
|
|
@ -85,7 +85,8 @@ void test(char *filename) {
|
|||
cout << "**** starting benchmark ****" << endl;
|
||||
for (int i = 0; i < 50; i++) {
|
||||
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||
assert(snpe->execute(inputTensorMap, outputTensorMap));
|
||||
int err = snpe->execute(inputTensorMap, outputTensorMap);
|
||||
assert(err == true);
|
||||
clock_gettime(CLOCK_MONOTONIC, &end);
|
||||
uint64_t timeElapsed = timespecDiff(&end, &start);
|
||||
printf("time: %f ms\n", timeElapsed*1.0/1e6);
|
||||
|
|
Loading…
Reference in New Issue