]> git.ipfire.org Git - thirdparty/libcgroup.git/log
thirdparty/libcgroup.git
4 years agoMerge pull request #48 from drakenclimber/issues/apt-update
Tom Hromatka [Tue, 1 Jun 2021 18:42:00 +0000 (12:42 -0600)] 
Merge pull request #48 from drakenclimber/issues/apt-update

github: Run apt update before apt install

4 years agogithub: Run apt update before apt install 48/head
Tom Hromatka [Tue, 1 Jun 2021 18:25:10 +0000 (12:25 -0600)] 
github: Run apt update before apt install

Run apt update before apt install

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoMerge pull request #23 from drakenclimber/issues/delete-cgclear
Tom Hromatka [Tue, 1 Jun 2021 13:44:48 +0000 (07:44 -0600)] 
Merge pull request #23 from drakenclimber/issues/delete-cgclear

ftests: Delete the cgclear functional test

4 years agoMerge pull request #22 from drakenclimber/issues/cgexec-test
Tom Hromatka [Mon, 24 May 2021 15:41:02 +0000 (09:41 -0600)] 
Merge pull request #22 from drakenclimber/issues/cgexec-test

Add a cgexec functional test

4 years agocgclear: Delete cgclear 47/head 49/head
Tom Hromatka [Tue, 18 May 2021 18:34:33 +0000 (18:34 +0000)] 
cgclear: Delete cgclear

With systemd managing the mounting/unmounting of
cgroups, cgclear no longer makes sense.  Remove it.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Delete the cgclear functional test
Tom Hromatka [Tue, 18 May 2021 18:33:14 +0000 (18:33 +0000)] 
ftests: Delete the cgclear functional test

Delete the cgclear functional test.  cgclear has been
removed from libcgroup.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoftests: Add a cgexec test
Tom Hromatka [Mon, 17 May 2021 14:22:48 +0000 (14:22 +0000)] 
ftests: Add a cgexec test

Add a basic cgexec test

-----------------------------------------------------------------
Test Results:
        Run Date:                          May 03 19:56:02
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                        11.87
        034-cgexec-basic_cgexec.py                    2.55
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                               14.42

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agocgroup.py: Add method to get pids in a cgroup
Tom Hromatka [Mon, 17 May 2021 14:15:59 +0000 (14:15 +0000)] 
cgroup.py: Add method to get pids in a cgroup

Add a method, get_pids_in_cgroup(), that will return
the pids in a given cgroup.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agoprocess.py: Add support for cgexec'ing a new process
Tom Hromatka [Mon, 17 May 2021 14:12:37 +0000 (14:12 +0000)] 
process.py: Add support for cgexec'ing a new process

Add support for cgexec to create_process_in_cgroup().
cgclassify still remains as the default process assignment
mechanism.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
4 years agocgroup.py: Add support for cgexec
Tom Hromatka [Mon, 17 May 2021 14:04:37 +0000 (14:04 +0000)] 
cgroup.py: Add support for cgexec

Add support for cgexec to the Cgroup class.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoautomake: replace CPPFLAGS by AM_CPPFLAGS
Tomasz Kłoczko [Wed, 12 May 2021 20:36:17 +0000 (20:36 +0000)] 
automake: replace CPPFLAGS by AM_CPPFLAGS

To not interfere with env $CPPFLAGS it is better to use AM_CPPFLAGS

Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoautomake: build PAM module as unversioned DSO
Tomasz Kłoczko [Wed, 12 May 2021 20:36:02 +0000 (20:36 +0000)] 
automake: build PAM module as unversioned DSO

PAM modules should be build as unversioned DSO.
Add -avoid-version to pam_cgroup_la_LDFLAGS

Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoautomake: replace INCLUDES by CPPFLAGS
Tomasz Kłoczko [Wed, 12 May 2021 20:35:40 +0000 (20:35 +0000)] 
automake: replace INCLUDES by CPPFLAGS

automake shows warnings like below:

src/Makefile.am:16: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/Makefile.am: installing 'build-aux/depcomp'
src/bindings/Makefile.am:2: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/daemon/Makefile.am:3: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/pam/Makefile.am:1: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/tools/Makefile.am:3: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')

Signed-off-by: Tomasz Kłoczko <kloczek@github.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoUpdate version number to 2.0 v2.0
Tom Hromatka [Thu, 6 May 2021 14:14:30 +0000 (14:14 +0000)] 
Update version number to 2.0

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoMerge pull request #21 from drakenclimber/issues/skip-tests
Tom Hromatka [Wed, 5 May 2021 15:24:00 +0000 (09:24 -0600)] 
Merge pull request #21 from drakenclimber/issues/skip-tests

ftests.py: Allow for skipping of multiple tests

5 years agoftests.py: Allow for skipping of multiple tests
Tom Hromatka [Wed, 5 May 2021 15:19:17 +0000 (11:19 -0400)] 
ftests.py: Allow for skipping of multiple tests

In anticipation of some tests not running nicely on some
distros, make the ftests.py --skip/-S option smarter so that
it can accept a single test or multiple tests separated by a
comma.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoMerge pull request #42 from drakenclimber/issues/update-map
Tom Hromatka [Mon, 3 May 2021 21:15:50 +0000 (15:15 -0600)] 
Merge pull request #42 from drakenclimber/issues/update-map

libcgroup.map: Update version number

5 years agolibcgroup.map: Update version number 42/head
Tom Hromatka [Mon, 3 May 2021 21:02:04 +0000 (15:02 -0600)] 
libcgroup.map: Update version number

Update the version number for the most recent exported
functions.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoMerge pull request #41 from drakenclimber/issues/fix-warnings
Tom Hromatka [Fri, 30 Apr 2021 13:47:10 +0000 (07:47 -0600)] 
Merge pull request #41 from drakenclimber/issues/fix-warnings

Fix warnings

5 years agoMerge pull request #20 from drakenclimber/issues/fix-warnings
Tom Hromatka [Fri, 30 Apr 2021 13:39:03 +0000 (07:39 -0600)] 
Merge pull request #20 from drakenclimber/issues/fix-warnings

Fix warnings in libcgroup-tests repo

5 years agoparse.y: Fix nonterminal %type warnings 41/head
Tom Hromatka [Tue, 27 Apr 2021 19:24:41 +0000 (19:24 +0000)] 
parse.y: Fix nonterminal %type warnings

Fix the following warnings in parse.y:

../parse.y:48.14-15: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
   48 | %type <name> ID DEFAULT group_name
      |              ^~
../parse.y:48.17-23: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
   48 | %type <name> ID DEFAULT group_name
      |                 ^~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agogunit: Fix an snprintf() truncation warning
Tom Hromatka [Tue, 27 Apr 2021 17:21:27 +0000 (17:21 +0000)] 
gunit: Fix an snprintf() truncation warning

Fix the following snprintf() string truncation warning:

013-cgroup_build_tasks_procs_path.cpp:65:22: warning: ‘%s’ directive output may be truncated writing up
to 820799 bytes into a region of size 4081 [-Wformat-truncation=]
   65 |      "/sys/fs/cgroup/%s", cg_mount_table[i].name);
      |                      ^~
In file included from /usr/include/stdio.h:867,
                 from /usr/include/c++/9/cstdio:42,
                 from /usr/include/c++/9/ext/string_conversions.h:43,
                 from /usr/include/c++/9/bits/basic_string.h:6493,
                 from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/ostream:38,
                 from ../../googletest/googletest/include/gtest/gtest.h:55,
                 from 013-cgroup_build_tasks_procs_path.cpp:22:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 16 an
d 820815 bytes into a destination of size 4096
   67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |        __bos (__s), __fmt, __va_arg_pack ());
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agogunit: Fix an snprintf() truncation warning
Tom Hromatka [Tue, 27 Apr 2021 17:19:40 +0000 (17:19 +0000)] 
gunit: Fix an snprintf() truncation warning

Fix the following snprintf() string truncation warning:

001-path.cpp: In member function ‘virtual void BuildPathV1Test::SetUp()’:
001-path.cpp:70:22: warning: ‘%s’ directive output may be truncated writing up to 820799 bytes into a re
gion of size 4081 [-Wformat-truncation=]
   70 |      "/sys/fs/cgroup/%s", cg_mount_table[i].name);
      |                      ^~
In file included from /usr/include/stdio.h:867,
                 from /usr/include/c++/9/cstdio:42,
                 from /usr/include/c++/9/ext/string_conversions.h:43,
                 from /usr/include/c++/9/bits/basic_string.h:6493,
                 from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/ostream:38,
                 from ../../googletest/googletest/include/gtest/gtest.h:55,
                 from 001-path.cpp:22:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin___snprintf_chk’ output between 16 an
d 820815 bytes into a destination of size 4096
   67 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   68 |        __bos (__s), __fmt, __va_arg_pack ());
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoMakefile.am/tests: Do not compile the old tests
Tom Hromatka [Tue, 27 Apr 2021 17:12:15 +0000 (17:12 +0000)] 
Makefile.am/tests: Do not compile the old tests

For historical reasons, the old tests remain in the testing
directory but are not being run or installed.

Due to compiler warnings from newer versions of GCC, do not
compile these tests.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agolscgroup: Fix strncpy() truncation warning
Tom Hromatka [Tue, 27 Apr 2021 17:08:38 +0000 (17:08 +0000)] 
lscgroup: Fix strncpy() truncation warning

Fix the following strncpy() string truncation warning:

In function ‘strncat’,
    inlined from ‘print_cgroup’ at lscgroup.c:149:4:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: warning: ‘__builtin___strncat_chk’ output
may be truncated copying between 0 and 4095 bytes from a string of length 4095 [-Wstringop-truncation]
  136 |   return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agolscgroup: Fix strncpy() truncation warning
Tom Hromatka [Tue, 27 Apr 2021 17:07:31 +0000 (17:07 +0000)] 
lscgroup: Fix strncpy() truncation warning

Fix the following strncpy() string truncation warning:

In function ‘strncpy’,
    inlined from ‘display_controller_data’ at lscgroup.c:104:2:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ specified bound 4096 equals destination size [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agolscgroup: Fix strncpy() truncation warning
Tom Hromatka [Tue, 27 Apr 2021 17:06:26 +0000 (17:06 +0000)] 
lscgroup: Fix strncpy() truncation warning

Fix the following strncpy() string truncation warning:

In function ‘strncpy’,
    inlined from ‘display_controller_data’ at lscgroup.c:99:2:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ specified bound 4096 equals destination size [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agolssubsys: Fix strncpy() truncation warning
Tom Hromatka [Tue, 27 Apr 2021 17:04:21 +0000 (17:04 +0000)] 
lssubsys: Fix strncpy() truncation warning

Fix the following strncpy() string truncation warning:

In function ‘strncpy’,
    inlined from ‘print_all_controllers_in_hierarchy’ at lssubsys.c:131:4,
    inlined from ‘cgroup_list_all_controllers’ at lssubsys.c:225:9,
    inlined from ‘main’ at lssubsys.c:293:8:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output may be truncated copying 4095 bytes from a string of length 4095 [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agolssubsys: Fix strncpy() truncation warning
Tom Hromatka [Tue, 27 Apr 2021 17:03:18 +0000 (17:03 +0000)] 
lssubsys: Fix strncpy() truncation warning

Fix the following strncpy() string truncation warning:

In function ‘strncpy’,
    inlined from ‘print_all_controllers_in_hierarchy’ at lssubsys.c:127:4,
    inlined from ‘cgroup_list_all_controllers’ at lssubsys.c:223:9,
    inlined from ‘main’ at lssubsys.c:291:8:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output may be truncated copying 4095 bytes from a string of length 4095 [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agolssubsys: Fix strncpy() truncation warning
Tom Hromatka [Tue, 27 Apr 2021 16:58:12 +0000 (16:58 +0000)] 
lssubsys: Fix strncpy() truncation warning

Fix the following strncpy() string truncation warning:

In function ‘strncat’,
    inlined from ‘print_all_controllers_in_hierarchy’ at lssubsys.c:134:4,
    inlined from ‘cgroup_list_all_controllers’ at lssubsys.c:222:9,
    inlined from ‘main’ at lssubsys.c:290:8:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: warning: ‘__builtin___strncat_chk’ output may be truncated copying 4095 bytes from a string of length 4095 [-Wstringop-truncation]
  136 |   return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agocgget: Fix strncpy() truncation warning
Tom Hromatka [Tue, 27 Apr 2021 16:53:44 +0000 (16:53 +0000)] 
cgget: Fix strncpy() truncation warning

Fix the following strncpy() string truncation warning:

In function ‘strncat’,
    inlined from ‘fill_empty_controller’ at cgget.c:584:2:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: warning: ‘__builtin___strncat_chk’ output may be truncated copying between 0 and 4095 bytes from a string of length 4095 [-Wstringop-truncation]
  136 |   return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agotools: Fix strncpy() truncation warning
Tom Hromatka [Tue, 27 Apr 2021 16:50:53 +0000 (16:50 +0000)] 
tools: Fix strncpy() truncation warning

Fix the following strncpy() string truncation warning:

In function ‘strncpy’,
    inlined from ‘parse_cgroup_spec’ at ../tools/tools-common.c:92:2:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ specified bound 4096 equals destination size [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoconfig.c: Fix strncpy() truncation warning
Tom Hromatka [Tue, 27 Apr 2021 16:48:33 +0000 (16:48 +0000)] 
config.c: Fix strncpy() truncation warning

Fix the following strncpy() string truncation warning:

In function ‘strncpy’,
    inlined from ‘cgroup_config_create_template_group’ at config.c:1850:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output may be truncated copying 4095 bytes from a string of length 4095 [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoconfig.c: Fix strncpy() truncation warning
Tom Hromatka [Tue, 27 Apr 2021 16:46:24 +0000 (16:46 +0000)] 
config.c: Fix strncpy() truncation warning

Fix the following strncpy() string truncation warning:

In function ‘strncpy’,
    inlined from ‘cgroup_config_create_template_group’ at config.c:1844:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output may be truncated copying 4095 bytes from a string of length 4095 [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoconfig.c: Fix strncpy() truncation warning
Tom Hromatka [Tue, 27 Apr 2021 16:42:41 +0000 (16:42 +0000)] 
config.c: Fix strncpy() truncation warning

Fix the following strncpy() string truncation warning:

In function ‘strncpy’,
    inlined from ‘cgroup_config_create_template_group’ at config.c:1841:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output may be truncated copying 4095 bytes from a string of length 4095 [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoapi.c: Fix strncpy() truncation warning
Tom Hromatka [Tue, 27 Apr 2021 16:40:39 +0000 (16:40 +0000)] 
api.c: Fix strncpy() truncation warning

Fix the following strncpy() string truncation warning:

In function ‘strncat’,
    inlined from ‘cgroup_get_cgroup’ at api.c:3153:3:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: warning: ‘__builtin___strncat_chk’ output may be truncated copying between 0 and 4095 bytes from a string of length 4095 [-Wstringop-truncation]
  136 |   return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoapi.c: Fix strncpy() truncation warning
Tom Hromatka [Tue, 27 Apr 2021 16:35:46 +0000 (16:35 +0000)] 
api.c: Fix strncpy() truncation warning

Fix the following strncpy() string truncation warning:

In function ‘strncpy’,
    inlined from ‘cgroup_parse_rules_file’ at api.c:814:3:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output may be truncated copying 4095 bytes from a string of length 4095 [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoapi.c: Fix strncpy() truncation warning
Tom Hromatka [Tue, 27 Apr 2021 16:32:10 +0000 (16:32 +0000)] 
api.c: Fix strncpy() truncation warning

Fix the following strncpy() string truncation warning:

In function ‘strncpy’,
    inlined from ‘cgroup_parse_rules_file’ at api.c:798:3:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin___strncpy_chk’ output may be truncated copying between 0 and 255 bytes from a string of length 255 [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoapi.c: Fix strncpy() truncation warning
Tom Hromatka [Tue, 27 Apr 2021 16:30:21 +0000 (16:30 +0000)] 
api.c: Fix strncpy() truncation warning

Fix the following strncpy() string truncation warning:

In function ‘strncpy’,
    inlined from ‘cgroup_parse_rules_file’ at api.c:676:3:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin___strncpy_chk’ output may be truncated copying between 0 and 255 bytes from a string of length 4352 [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agodoc: Update github release process
Tom Hromatka [Mon, 26 Apr 2021 22:06:01 +0000 (22:06 +0000)] 
doc: Update github release process

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoUpdate version number to 2.0.rc1 v2.0.rc1
Tom Hromatka [Mon, 26 Apr 2021 21:16:26 +0000 (21:16 +0000)] 
Update version number to 2.0.rc1

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoMakefile.am: Remove default.conf
Tom Hromatka [Mon, 26 Apr 2021 19:44:12 +0000 (19:44 +0000)] 
Makefile.am: Remove default.conf

Remove the reference in EXTRA_DIST to default.conf.
default.conf was deleted in e326a57222e8 ("ftests: Remove
unused config files").

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoMerge pull request #40 from drakenclimber/issues/38
Tom Hromatka [Mon, 19 Apr 2021 14:43:21 +0000 (08:43 -0600)] 
Merge pull request #40 from drakenclimber/issues/38

cgget: Fix segfault when no flags provided

5 years agoMerge pull request #19 from drakenclimber/issues/38
Tom Hromatka [Mon, 19 Apr 2021 14:33:39 +0000 (08:33 -0600)] 
Merge pull request #19 from drakenclimber/issues/38

ftests: Add cgget test with no flags

5 years agocgget: Fix segfault when no flags provided 40/head
Tom Hromatka [Wed, 14 Apr 2021 16:02:44 +0000 (10:02 -0600)] 
cgget: Fix segfault when no flags provided

Fix a segmentation fault when cgget is invoked in the
following form:
cgget CroupName

parse_opt_args() was erroneously expecting a previously
populated struct cgroup in this case, and we were indexing
out of bounds of the cg_list.

Fixes: 1b7d606fa12a ("cgget: Major refactor")
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoMerge pull request #39 from drakenclimber/issues/fixwarnings
Tom Hromatka [Thu, 15 Apr 2021 20:42:02 +0000 (14:42 -0600)] 
Merge pull request #39 from drakenclimber/issues/fixwarnings

Fix compiler warnings

5 years agoMerge pull request #18 from drakenclimber/issues/fixtest004
Tom Hromatka [Thu, 15 Apr 2021 20:23:53 +0000 (14:23 -0600)] 
Merge pull request #18 from drakenclimber/issues/fixtest004

ftests: Allow test 004 to run on systems w/ or w/o swap

5 years agoftests: Allow test 004 to run on systems w/ or w/o swap
Tom Hromatka [Thu, 25 Mar 2021 20:03:35 +0000 (20:03 +0000)] 
ftests: Allow test 004 to run on systems w/ or w/o swap

Add smarts to test 004 so that it can be run on systems with
or without swap.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoMerge pull request #17 from drakenclimber/issues/lscgroup
Tom Hromatka [Thu, 15 Apr 2021 19:57:21 +0000 (13:57 -0600)] 
Merge pull request #17 from drakenclimber/issues/lscgroup

Add support and tests for lscgroup

5 years agoftests: Add cgget test with no flags
Tom Hromatka [Wed, 14 Apr 2021 17:06:25 +0000 (11:06 -0600)] 
ftests: Add cgget test with no flags

Add a cgget test that exercises the following format:
cgget CgroupName

-----------------------------------------------------------------
Test Results:
        Run Date:                          Apr 14 10:57:44
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                         0.00
        033-cgget-no_flags.py                         0.11
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                                0.11

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agogithub: Convert all compiler warnings to errors 39/head
Tom Hromatka [Mon, 12 Apr 2021 15:51:12 +0000 (09:51 -0600)] 
github: Convert all compiler warnings to errors

For the continuous integration in Github Actions, convert
all compiler warnings to errors.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agowrapper.c: Fix fprintf argument warning
Tom Hromatka [Mon, 12 Apr 2021 15:25:00 +0000 (09:25 -0600)] 
wrapper.c: Fix fprintf argument warning

Fix a warning in cgroup_add_value_string() where '%d' was
being passed to fprintf when it should have been using '%ld'.

wrapper.c: In function ‘cgroup_add_value_string’:
wrapper.c:207:51: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
  207 |    fprintf(stderr, "value exceeds the maximum of %d
      characters\n",
      |                                                  ~^
      |                                                   |
      |                                                   int
      |                                                  %ld
  208 |     sizeof(cntl_value->value) - 1);
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |     |
      |     long unsigned int

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoapi.c: Fix string truncation warnings
Tom Hromatka [Mon, 12 Apr 2021 15:18:56 +0000 (09:18 -0600)] 
api.c: Fix string truncation warnings

Fix two snprintf string truncation warnings in
cg_build_path_locked().

api.c:1475:38: warning: ‘snprintf’ output may be truncated before the
last format character [-Wformat-truncation=]
 1475 |     snprintf(path, FILENAME_MAX, "%s/",
      |                                      ^
api.c:1475:5: note: ‘snprintf’ output between 2 and 4097 bytes into a
destination of size 4096
 1475 |     snprintf(path, FILENAME_MAX, "%s/",
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1476 |       cg_mount_table[i].mount.path);
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
api.c:1470:40: warning: ‘/’ directive output may be truncated writing 1
byte into a region of size between 0 and 4095 [-Wformat-truncation=]
 1470 |     snprintf(path, FILENAME_MAX, "%s/%s/",
      |                                        ^
api.c:1470:5: note: ‘snprintf’ output 3 or more bytes (assuming 4098)
into a destination of size 4096
 1470 |     snprintf(path, FILENAME_MAX, "%s/%s/",
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1471 |       cg_mount_table[i].mount.path,
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1472 |       cg_namespace_table[i]);
      |       ~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoapi.c: Fix incompatible pointer warning
Tom Hromatka [Mon, 12 Apr 2021 14:39:43 +0000 (08:39 -0600)] 
api.c: Fix incompatible pointer warning

Fix the following incompatible pointer warning:

api.c: In function ‘cgroup_delete_cgroup_ext’:
api.c:2888:24: warning: passing argument 4 of
‘cgroup_build_tasks_procs_path’ from incompatible pointer type
[-Wincompatible-pointer-types]
 2888 |      cgroup->controller[i]);
      |      ~~~~~~~~~~~~~~~~~~^~~
      |                        |
      |                        struct cgroup_controller *

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoconfigure: Rename configure.in to configure.ac
Tom Hromatka [Mon, 12 Apr 2021 14:27:57 +0000 (08:27 -0600)] 
configure: Rename configure.in to configure.ac

Fix automake warning that configure.in should be named
configure.ac.

automake: warning: autoconf input should be named 'configure.ac', not 'configure.in'

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoftests: Add an lscgroup test with multiple '-g' flags
Tom Hromatka [Thu, 25 Mar 2021 16:35:32 +0000 (16:35 +0000)] 
ftests: Add an lscgroup test with multiple '-g' flags

Add an lscgroup test with multiple '-g' flags.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Mar 25 16:35:47
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                        14.12
        032-lscgroup-multiple_g_flags.py              4.63
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                               18.75

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoftests: Add an lscgroup test with a single '-g' flag
Tom Hromatka [Thu, 25 Mar 2021 16:34:47 +0000 (16:34 +0000)] 
ftests: Add an lscgroup test with a single '-g' flag

Add a test that invokes lscgroup with a single '-g' flag.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Mar 25 16:34:25
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                        18.41
        031-lscgroup-g_flag.py                        0.58
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                               18.98

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agocgroup.py: Add support for lscgroup
Tom Hromatka [Thu, 25 Mar 2021 16:33:38 +0000 (16:33 +0000)] 
cgroup.py: Add support for lscgroup

Add support for lscgroup to the Cgroup class.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoMerge pull request #37 from drakenclimber/issues/lssubsys
Tom Hromatka [Thu, 8 Apr 2021 16:50:49 +0000 (10:50 -0600)] 
Merge pull request #37 from drakenclimber/issues/lssubsys

Add cgroup v2 support to lssubsys

5 years agoMerge pull request #16 from drakenclimber/issues/lssubsys
Tom Hromatka [Thu, 8 Apr 2021 16:38:59 +0000 (10:38 -0600)] 
Merge pull request #16 from drakenclimber/issues/lssubsys

Add functional tests for lssubsys

5 years agolssubsys: Add cgroup v2 support 36/head 37/head
Tom Hromatka [Wed, 24 Mar 2021 16:38:22 +0000 (10:38 -0600)] 
lssubsys: Add cgroup v2 support

Ignore a hierarchy value of zero for cgroup v2 controllers.
This change adds minimal cgroup v2 support to lssubsys.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoftests: Add an lssubsys -a functional test
Tom Hromatka [Wed, 24 Mar 2021 19:12:44 +0000 (19:12 +0000)] 
ftests: Add an lssubsys -a functional test

Add a functional test that exercises 'lssubsys -a'

-----------------------------------------------------------------
Test Results:
        Run Date:                          Mar 24 19:12:33
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                        20.06
        030-lssubsys-lssubsys_all.py                  0.18
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                               20.23

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoftests: Add basic lssubsys test
Tom Hromatka [Wed, 24 Mar 2021 19:09:24 +0000 (19:09 +0000)] 
ftests: Add basic lssubsys test

Add a functional test that exercises lssubsys with no flags.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Mar 24 19:09:14
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                        23.47
        029-lssubsys-basic_lssubsys.py                0.15
        teardown                                      0.00
        --------------------------------------------------

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agocgroup.py: Add method to parse /proc/mounts for cgroup mounts
Tom Hromatka [Wed, 24 Mar 2021 19:43:42 +0000 (19:43 +0000)] 
cgroup.py: Add method to parse /proc/mounts for cgroup mounts

Add a method - Cgroup.get_cgroup_mounts() - that can parse
/proc/mounts and return a list of CgroupMount instances.
This method will be useful for validating results from lssubsys.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agocgroup.py: Add support for lssubsys
Tom Hromatka [Wed, 24 Mar 2021 18:56:23 +0000 (18:56 +0000)] 
cgroup.py: Add support for lssubsys

Add support for lssubsys to the Cgroup class.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoMerge pull request #35 from drakenclimber/issues/fixcgset
Tom Hromatka [Mon, 5 Apr 2021 15:21:05 +0000 (09:21 -0600)] 
Merge pull request #35 from drakenclimber/issues/fixcgset

Fix issue where cgset can't handle '=' in the value

5 years agoMerge pull request #15 from drakenclimber/issues/fixcgset
Tom Hromatka [Mon, 5 Apr 2021 15:12:14 +0000 (09:12 -0600)] 
Merge pull request #15 from drakenclimber/issues/fixcgset

gtest: Add unit test for cgset's parse_r_flag()

5 years agogtest: Add unit test for cgset's parse_r_flag()
Tom Hromatka [Wed, 31 Mar 2021 16:58:48 +0000 (16:58 +0000)] 
gtest: Add unit test for cgset's parse_r_flag()

Add a unit test for parse_r_flag() in cgset.c.

[----------] 1 test from CgsetParseRFlagTest
[ RUN      ] CgsetParseRFlagTest.EqualCharInValue
[       OK ] CgsetParseRFlagTest.EqualCharInValue (0 ms)
[----------] 1 test from CgsetParseRFlagTest (0 ms total)

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agocgset: Declare parse_r_flag() as STATIC 35/head
Tom Hromatka [Wed, 31 Mar 2021 16:55:51 +0000 (16:55 +0000)] 
cgset: Declare parse_r_flag() as STATIC

Declare parse_r_flag() as STATIC so that it can be
unit tested.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agotools: Create a cgset library for testing purposes
Tom Hromatka [Wed, 31 Mar 2021 16:44:11 +0000 (16:44 +0000)] 
tools: Create a cgset library for testing purposes

Create libcgset.la so that functions within cgset can be
unit tested.

A functional test would be preferable in this case, but I'm
looking to test a very specific scenario - where there's an
'=' sign in the value of a setting's name/value pair.  To the
best of my knowledge, only the rdma (v1) and io (v2)
controllers have settings that utilize an '=' in such a fashion.
I can't think of an easy way to test rdma across our test fleet,
and our automated systems don't support the v2 io controller
yet.  Thus a unit test for now.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agocgset: Fix parsing of name/values with an '=' in the value
Tom Hromatka [Tue, 30 Mar 2021 18:54:06 +0000 (18:54 +0000)] 
cgset: Fix parsing of name/values with an '=' in the value

Fix parsing of name/value pairs that contain an '='
character in the value string.  For example, the io.max
setting utilizes the '=' character:
cgset -r io.max="8:16 wbps=1024" foo

Fixes: https://github.com/libcgroup/libcgroup/issues/33
Reported-by: Santiago Ruano Rincón <santiago.ruano-rincon@imt-atlantique.fr>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agocgset: Refactor parsing of the '-r' flag
Tom Hromatka [Tue, 30 Mar 2021 18:40:11 +0000 (18:40 +0000)] 
cgset: Refactor parsing of the '-r' flag

Refactor parsing of the '-r' flag into its own function.
This is intended to be a nonfunctional change.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoMerge pull request #34 from drakenclimber/issues/cgclear2
Tom Hromatka [Fri, 2 Apr 2021 17:30:10 +0000 (11:30 -0600)] 
Merge pull request #34 from drakenclimber/issues/cgclear2

Add cgroup v2 support to cgclear

5 years agoMerge pull request #14 from drakenclimber/issues/cgclear
Tom Hromatka [Fri, 2 Apr 2021 17:22:12 +0000 (11:22 -0600)] 
Merge pull request #14 from drakenclimber/issues/cgclear

Add cgclear tests

5 years agoMerge pull request #32 from drakenclimber/issues/remove-libs
Tom Hromatka [Tue, 30 Mar 2021 14:11:59 +0000 (08:11 -0600)] 
Merge pull request #32 from drakenclimber/issues/remove-libs

build: Remove .libs from Makefile.am files.

5 years agobuild: Remove .libs from Makefile.am files. 32/head
Tom Hromatka [Tue, 30 Mar 2021 14:01:31 +0000 (08:01 -0600)] 
build: Remove .libs from Makefile.am files.

Remove .libs from Makefile.am files.  Suggested by
github user @orbea.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agogithub: Run the cgclear functional test last 34/head
Tom Hromatka [Tue, 23 Mar 2021 16:18:04 +0000 (16:18 +0000)] 
github: Run the cgclear functional test last

Run the cgclear functional test last since it is destructive to the
cgroup hierarchy.  Note that this test is automatically skipped by
'make check'.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agobootstrap: github: Ignore systemd hierarchy
Tom Hromatka [Mon, 29 Mar 2021 16:46:52 +0000 (16:46 +0000)] 
bootstrap: github: Ignore systemd hierarchy

Ignore the "name=systemd" hierarchy by setting the autoconf
--enable-opaque-hierarchy flag equal to "name=systemd".  This
instructs libcgroup to ignore mounts named "name=systemd" and
thus these mounts aren't added to the cg_mount_table[].

Suggested-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agogunit: Ignore systemd hierarchies in test 007
Tom Hromatka [Mon, 29 Mar 2021 17:54:09 +0000 (17:54 +0000)] 
gunit: Ignore systemd hierarchies in test 007

Now that systemd hierarchies are being ignored via the
OPAQUE_HIERARCHY setting, update unit test 007 to ensure
that systemd hierachies are not added to the mount table.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoconfig.c: Add cgroup v2 support to cgclear
Tom Hromatka [Tue, 23 Mar 2021 14:57:28 +0000 (08:57 -0600)] 
config.c: Add cgroup v2 support to cgclear

When cgclear is invoked against a cgroup v2 controller,
do not attempt to unmount the v2 controller.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoMerge pull request #30 from drakenclimber/issues/cgset-tests
Tom Hromatka [Mon, 29 Mar 2021 14:11:05 +0000 (08:11 -0600)] 
Merge pull request #30 from drakenclimber/issues/cgset-tests

api.c: Don't fail a recursive write if value isn't dirty

5 years agoMerge pull request #13 from drakenclimber/issues/cgset-tests2
Tom Hromatka [Mon, 29 Mar 2021 14:05:17 +0000 (08:05 -0600)] 
Merge pull request #13 from drakenclimber/issues/cgset-tests2

Add extensive cgset tests

5 years agoftests: Add a simple cgclear functional test
Tom Hromatka [Tue, 23 Mar 2021 16:12:13 +0000 (16:12 +0000)] 
ftests: Add a simple cgclear functional test

Add a test that invokes cgclear.  Note that this test is especially
destructive and is skipped by default.  Github Actions invokes it
separately as the final step.

-----------------------------------------------------------------
Test Results:
Run Date:                          Mar 23 16:07:55
Passed:                                  1 test(s)
Skipped:                                 0 test(s)
Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
Test                                    Time (sec)
---------------------------------------------------------
setup                                         0.00
028-cgclear-basic_cgclear.py                  1.80
teardown                                      0.00
---------------------------------------------------------
Total Run Time                                1.80

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoftests/consts: Add parser option to skip a test
Tom Hromatka [Tue, 23 Mar 2021 16:09:29 +0000 (16:09 +0000)] 
ftests/consts: Add parser option to skip a test

Add a flag, '-S' or '--skip', to allow a test number
to be skipped.  This will be used to skip the cgclear test
by default since it's so destructive.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agocgroup.py: Add support for cgclear
Tom Hromatka [Tue, 23 Mar 2021 16:08:26 +0000 (16:08 +0000)] 
cgroup.py: Add support for cgclear

Add support for cgclear to the Cgroup class.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoftests: Add pydoc documentation to Cgroup.set()
Tom Hromatka [Wed, 10 Mar 2021 18:54:29 +0000 (18:54 +0000)] 
ftests: Add pydoc documentation to Cgroup.set()

Add pydoc documentation for the Cgroup.set() method and reference
the automated tests that exercise various cgset commands.

The pydoc for Cgroup.set() is available by running:
$ python -c "from cgroup import Cgroup;help(Cgroup.set)"

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoftests: Add cgset invalid options test
Tom Hromatka [Wed, 10 Mar 2021 18:51:45 +0000 (18:51 +0000)] 
ftests: Add cgset invalid options test

Add a test that tests various invalid flag combinations to cgset.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Mar 08 17:39:20
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                        18.15
        027-cgset-invalid_options.py                  0.94
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                               19.09

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoftests: Add a cgset test with multiple '-r' flags and cgroups
Tom Hromatka [Wed, 10 Mar 2021 18:48:04 +0000 (18:48 +0000)] 
ftests: Add a cgset test with multiple '-r' flags and cgroups

Add a cgset test that provides multiple '-r' flags to multiple
cgroups.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Mar 08 19:30:43
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                        15.33
        026-cgset-multiple_r_multiple_cgroup.py       5.14
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                               20.47

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoftests: Add multiple cgroup cgset set
Tom Hromatka [Wed, 10 Mar 2021 18:47:03 +0000 (18:47 +0000)] 
ftests: Add multiple cgroup cgset set

Add a test that passes in multiple cgroups to cgset.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Mar 08 19:14:20
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                        19.85
        025-cgset-multiple_cgroups.py                 0.85
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                               20.69

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoftests: Add cgset --copy-from test
Tom Hromatka [Wed, 10 Mar 2021 17:36:28 +0000 (17:36 +0000)] 
ftests: Add cgset --copy-from test

Add a test that utilizes the cgset --copy-from flag.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Mar 02 20:24:45
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                        22.79
        023-cgset-copy_from.py                        1.13
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                               23.93

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoftests: Add multiple -r flag cgset test
Tom Hromatka [Wed, 10 Mar 2021 17:32:18 +0000 (17:32 +0000)] 
ftests: Add multiple -r flag cgset test

Add a test that provides multiple -r flags to cgset

-----------------------------------------------------------------
Test Results:
        Run Date:                          Mar 02 19:04:36
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                        14.53
        022-cgset-multiple_r_flag.py                  0.72
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                               15.25

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agocgroup.py: Add -h support to Cgroup.set()
Tom Hromatka [Wed, 10 Mar 2021 17:22:52 +0000 (17:22 +0000)] 
cgroup.py: Add -h support to Cgroup.set()

Add support for the '-h' flag to Cgroup.set()

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agocgroup.py: Allow for multiple cgroup names to be passed to cgset
Tom Hromatka [Wed, 10 Mar 2021 17:16:30 +0000 (17:16 +0000)] 
cgroup.py: Allow for multiple cgroup names to be passed to cgset

Add support for multiple cgroup names - or no cgroup names -
to be passed into Cgroup.set().  cgset allows multiple cgroup
names to be supplied with either the '-r' flag or the '--copy-from'
option.  No cgroup needs to be provided when '-h' is invoked.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agocgroup.py: Add support for cgset --copy-from flag
Tom Hromatka [Wed, 10 Mar 2021 17:15:19 +0000 (17:15 +0000)] 
cgroup.py: Add support for cgset --copy-from flag

Add support for cgset's --copy-from flag to Cgroup.set().

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agogunit: Update test 009 to match cgroup_set_values_recursive()
Tom Hromatka [Wed, 10 Mar 2021 18:21:25 +0000 (18:21 +0000)] 
gunit: Update test 009 to match cgroup_set_values_recursive()

cgroup_set_values_recursive() had a parameter added to ignore
the dirty flag on write failures.  This is needed by
cgroup_modify_cgroup() as some writes may be expected to fail.

Update test 009 to utilize this new flag.  Note that
cgroup_set_values_recursive() is now being heavily tested by
the functional tests, so this unit test is no longer the primary
means of testing this function.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoMerge pull request #12 from drakenclimber/issues/cgconfig-tests2
Tom Hromatka [Mon, 22 Mar 2021 17:11:54 +0000 (11:11 -0600)] 
Merge pull request #12 from drakenclimber/issues/cgconfig-tests2

Add functional tests for cgconfigparser

5 years agocgroup.py: Add pydoc documentation to Cgroup.configparser()
Tom Hromatka [Wed, 10 Mar 2021 14:29:22 +0000 (14:29 +0000)] 
cgroup.py: Add pydoc documentation to Cgroup.configparser()

Add pydoc documentation for the Cgroup.configparser() method and
reference the automated tests that exercise various cgconfigparser
commands.

The pydoc for Cgroup.configparser() is available by running:
$ python -c "from cgroup import Cgroup;help(Cgroup.configparser)"

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoftests: Add invalid parameter test for cgconfigparser
Tom Hromatka [Wed, 10 Mar 2021 02:15:51 +0000 (02:15 +0000)] 
ftests: Add invalid parameter test for cgconfigparser

Add a test that provides invalid parameters into cgconfigparser.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Mar 10 02:15:56
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                        13.46
        021-cgconfig-invalid_options.py               0.31
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                               13.77

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoftests: Add a cgconfigparser test that sets tasks owner/permissions
Tom Hromatka [Wed, 10 Mar 2021 00:18:02 +0000 (00:18 +0000)] 
ftests: Add a cgconfigparser test that sets tasks owner/permissions

Add a cgconfigparser test that sets the owner, group, and
permissions on the tasks file.  This test runs on cgroup v1
only.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Mar 10 00:18:10
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                        14.47
        020-cgconfig-tasks_perms_owner.py             7.14
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                               21.61

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
5 years agoftests: Add a cgconfigparser owner, fperm, and dperm test
Tom Hromatka [Tue, 9 Mar 2021 22:30:33 +0000 (22:30 +0000)] 
ftests: Add a cgconfigparser owner, fperm, and dperm test

Add a cgconfigparser test that verifies that the owner,
group, file permissions, and directory permissions are
properly set.

-----------------------------------------------------------------
Test Results:
        Run Date:                          Mar 09 22:29:07
        Passed:                                  1 test(s)
        Skipped:                                 0 test(s)
        Failed:                                  0 test(s)
-----------------------------------------------------------------
Timing Results:
        Test                                    Time (sec)
        ---------------------------------------------------------
        setup                                        20.58
        019-cgconfig-uidgid_dperm_fperm.py            2.51
        teardown                                      0.00
        ---------------------------------------------------------
        Total Run Time                               23.10

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>