Fix value_str() usage
This commit is contained in:
parent
e287087d3b
commit
467cc9aa7e
@ -250,9 +250,8 @@ cpu_update(struct cpu *cpu)
|
|||||||
err("chan_set pid failed");
|
err("chan_set pid failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
char buf[128];
|
|
||||||
dbg("cpu%ld sets th_running to %s",
|
dbg("cpu%ld sets th_running to %s",
|
||||||
cpu->gindex, value_str(gid_running, buf));
|
cpu->gindex, value_str(gid_running));
|
||||||
if (chan_set(&cpu->chan[CPU_CHAN_THRUN], gid_running) != 0) {
|
if (chan_set(&cpu->chan[CPU_CHAN_THRUN], gid_running) != 0) {
|
||||||
err("chan_set gid_running failed");
|
err("chan_set gid_running failed");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -78,8 +78,6 @@ cb_select(struct chan *sel_chan, void *ptr)
|
|||||||
mux->selected = -1;
|
mux->selected = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char buf[128];
|
|
||||||
UNUSED(buf);
|
|
||||||
dbg("select channel got value %s",
|
dbg("select channel got value %s",
|
||||||
value_str(sel_value));
|
value_str(sel_value));
|
||||||
|
|
||||||
@ -104,7 +102,7 @@ cb_select(struct chan *sel_chan, void *ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dbg("setting output chan %s to %s",
|
dbg("setting output chan %s to %s",
|
||||||
mux->output->name, value_str(out_value, buf));
|
mux->output->name, value_str(out_value));
|
||||||
|
|
||||||
if (chan_set(mux->output, out_value) != 0) {
|
if (chan_set(mux->output, out_value) != 0) {
|
||||||
err("chan_set() failed");
|
err("chan_set() failed");
|
||||||
|
@ -105,8 +105,7 @@ select_tr(struct mux *mux, struct value value, struct mux_input **input)
|
|||||||
static int
|
static int
|
||||||
select_idle(struct mux *mux, struct value value, struct mux_input **input)
|
select_idle(struct mux *mux, struct value value, struct mux_input **input)
|
||||||
{
|
{
|
||||||
char buf[128];
|
dbg("value is %s", value_str(value));
|
||||||
dbg("value is %s", value_str(value, buf));
|
|
||||||
if (value.type == VALUE_INT64 && value.i == ST_WORKER_IDLE) {
|
if (value.type == VALUE_INT64 && value.i == ST_WORKER_IDLE) {
|
||||||
dbg("selecting input 1 (idle)");
|
dbg("selecting input 1 (idle)");
|
||||||
*input = mux_get_input(mux, 1);
|
*input = mux_get_input(mux, 1);
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
//#define ENABLE_DEBUG
|
//#define ENABLE_DEBUG
|
||||||
|
|
||||||
#include "sort.h"
|
#include "sort.h"
|
||||||
|
#include "chan.h"
|
||||||
|
#include "value.h"
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cmp_int64(const void *a, const void *b)
|
cmp_int64(const void *a, const void *b)
|
||||||
@ -119,9 +121,8 @@ sort_cb_input(struct chan *in_chan, void *ptr)
|
|||||||
if (value_is_equal(&last, &val))
|
if (value_is_equal(&last, &val))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
char buf[128];
|
|
||||||
dbg("writting value %s into channel %s",
|
dbg("writting value %s into channel %s",
|
||||||
value_str(val, buf),
|
value_str(val),
|
||||||
sort->outputs[i].name);
|
sort->outputs[i].name);
|
||||||
|
|
||||||
if (chan_set(&sort->outputs[i], val) != 0) {
|
if (chan_set(&sort->outputs[i], val) != 0) {
|
||||||
@ -171,7 +172,7 @@ sort_init(struct sort *sort, struct bay *bay, int64_t n, const char *name)
|
|||||||
|
|
||||||
/* No duplicate checks are done by sort module, so we
|
/* No duplicate checks are done by sort module, so we
|
||||||
* simply allow them */
|
* simply allow them */
|
||||||
chan_prop_set(out, CHAN_DUPLICATES, 1);
|
chan_prop_set(out, CHAN_ALLOW_DUP, 1);
|
||||||
|
|
||||||
if (bay_register(bay, out) != 0) {
|
if (bay_register(bay, out) != 0) {
|
||||||
err("bay_register out%ld failed", i);
|
err("bay_register out%ld failed", i);
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include "emu/sort.h"
|
#include "emu/sort.h"
|
||||||
|
#include "chan.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "unittest.h"
|
#include "unittest.h"
|
||||||
|
#include "value.h"
|
||||||
|
|
||||||
#define N 10
|
#define N 10
|
||||||
|
|
||||||
@ -14,15 +16,13 @@ check_output(struct chan *chan, struct value expected)
|
|||||||
if (chan_read(chan, &out_value) != 0)
|
if (chan_read(chan, &out_value) != 0)
|
||||||
die("chan_read() failed for channel %s", chan->name);
|
die("chan_read() failed for channel %s", chan->name);
|
||||||
|
|
||||||
char buf1[128];
|
|
||||||
if (!value_is_equal(&out_value, &expected)) {
|
if (!value_is_equal(&out_value, &expected)) {
|
||||||
char buf2[128];
|
|
||||||
die("unexpected value found %s in output (expected %s)\n",
|
die("unexpected value found %s in output (expected %s)\n",
|
||||||
value_str(out_value, buf1),
|
value_str(out_value),
|
||||||
value_str(expected, buf2));
|
value_str(expected));
|
||||||
}
|
}
|
||||||
|
|
||||||
err("output ok: chan=%s val=%s", chan->name, value_str(out_value, buf1));
|
err("output ok: chan=%s val=%s", chan->name, value_str(out_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user