File: 016-cgset_parse_r_flag.cpp

package info (click to toggle)
libcgroup 3.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,764 kB
  • sloc: ansic: 14,997; cpp: 9,957; python: 8,340; sh: 5,194; yacc: 470; makefile: 400; lex: 38
file content (39 lines) | stat: -rw-r--r-- 921 bytes parent folder | download
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
/* SPDX-License-Identifier: LGPL-2.1-only */
/**
 * libcgroup googletest for parse_r_flag() in cgset
 *
 * Copyright (c) 2021 Oracle and/or its affiliates.
 * Author: Tom Hromatka <tom.hromatka@oracle.com>
 */

#include <ftw.h>

#include "gtest/gtest.h"

#include "libcgroup-internal.h"
#include "tools-common.h"

static const char * const PARENT_DIR = "test016cgset/";

static const char * const NAME = "io.max";
static const char * const VALUE = "\"8:16 wbps=1024\"";

class CgsetParseRFlagTest : public ::testing::Test {
};

TEST_F(CgsetParseRFlagTest, EqualCharInValue)
{
	struct control_value name_value;
	char name_value_str[4092];
	int ret;

	ret = snprintf(name_value_str, sizeof(name_value_str) -1,
		       "%s=%s", NAME, VALUE);
	ASSERT_GT(ret, 0);

	ret = parse_r_flag("cgset", name_value_str, &name_value);
	ASSERT_EQ(ret, 0);

	ASSERT_STREQ(name_value.name, NAME);
	ASSERT_STREQ(name_value.value, VALUE);
}