[LTP] [PATCH 3/3] cgroup: Add memcontrol02

Cyril Hrubis chrubis@suse.cz
Tue Dec 21 12:14:40 CET 2021


Hi!
> > But even then all the macros all written in a way that they do expect
> > a syscall as a first parameter and the messages are not clear.
> 
> Possibly it should just be TST_EXP(bool_expr, fmt, ...). That would be like
> practically every other testing framework. OTOH LTP is somewhat special
> as we usually are checking the return value of a syscall. So I should
> probably leave these macros alone in this case.

Sounds reasonably.

> > Maybe we need a different solution. We already have tst_assert_foo()
> > functions for sysfs/proc files so maybe we need something as compare
> > function for the cgroup file attributes:
> 
> Frankly that is poor naming. One would expect tst_assert to be similar
> to assert from assert.h.

Feel free to propose rename if you have a better idea.

> >
> > 	enum cmp {
> > 		CMP_EQ,
> > 		CMP_NE,
> > 		CMP_LT,
> > 		CMP_GT,
> > 		CMP_LE,
> > 		CMP_GE,
> > 		CMP_EPS,
> > 	};
> >
> > 	CGROUP_ASSERT_CMP_SIZE(cg_child, "memory.current", CMP_EQ, 0);
> >
> > 	CGROUP_ASSERT_CMP_SIZE(cg_child, "memory.current", CMP_EPS, file, 10);
> >
> >
> > 	or even simple macro that would compare two values accordingly
> > 	to the OP and print PASS/FAIL would be better than this.
> >
> 
> I think it would be simpler to just create a general assert_expr
> macro. The above function won't neatly handle loading multiple values
> from multiple files. Nor will it handle transforming values.

Yes, that is one of the limitations.

> We could implement SQL queries for sys files, like osquery, that would
> be neat!

Hmm, we do allready have boolean parser in LTP library, maybe we can
just reuse that, as long as we add a code that parses specified sysfs
files into variables that are passed to the parser it should work
reasonably well for us.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list