@@ -106,17 +106,12 @@ function cpus_to_mask() {
106106}
107107
108108@test " runc run [CPU affinity should reset]" {
109- # We need to use RUNC_CMDLINE since taskset requires a proper binary, not a
110- # bash function (which is what runc and __runc are).
111- setup_runc_cmdline
112-
113109 first=" $( first_cpu) "
114110
115111 # Running without cpuset should result in an affinity for all CPUs.
116112 update_config ' .process.args = [ "/bin/grep", "-F", "Cpus_allowed_list:", "/proc/self/status" ]'
117113 update_config ' del(.linux.resources.cpu)'
118- sane_run taskset -c " $first " " ${RUNC_CMDLINE[@]} " run ctr
119- [ " $status " -eq 0 ]
114+ PRE_CMD=" taskset -c $first " runc -0 run ctr
120115 [[ " $output " != $' Cpus_allowed_list:\t ' " $first " ]]
121116 [[ " $output " == $' Cpus_allowed_list:\t ' " $INITIAL_CPU_MASK " ]]
122117}
@@ -125,47 +120,35 @@ function cpus_to_mask() {
125120 [ $EUID -ne 0 ] && requires rootless_cgroup
126121 set_cgroups_path
127122
128- # We need to use RUNC_CMDLINE since taskset requires a proper binary, not a
129- # bash function (which is what runc and __runc are).
130- setup_runc_cmdline
131-
132123 first=" $( first_cpu) "
133124 second=" $(( first + 1 )) " # Hacky; might not work in all environments.
134125
135126 # Running with a cpuset should result in an affinity that matches.
136127 update_config ' .process.args = [ "/bin/grep", "-F", "Cpus_allowed_list:", "/proc/self/status" ]'
137128 update_config ' .linux.resources.cpu = {"mems": "0", "cpus": "' " $first -$second " ' "}'
138- sane_run taskset -c " $first " " ${RUNC_CMDLINE[@]} " run ctr
139- [ " $status " -eq 0 ]
129+ PRE_CMD=" taskset -c $first " runc -0 run ctr
140130 [[ " $output " != $' Cpus_allowed_list:\t ' " $first " ]]
141131 # XXX: For some reason, systemd-cgroup leads to us using the all-set
142132 # cpumask rather than the cpuset we configured?
143133 [ -v RUNC_USE_SYSTEMD ] || [[ " $output " == $' Cpus_allowed_list:\t ' " $first -$second " ]]
144134
145135 # Ditto for a cpuset that has no overlap with the original cpumask.
146136 update_config ' .linux.resources.cpu = {"mems": "0", "cpus": "' " $second " ' "}'
147- sane_run taskset -c " $first " " ${RUNC_CMDLINE[@]} " run ctr
148- [ " $status " -eq 0 ]
137+ PRE_CMD=" taskset -c $first " runc -0 run ctr
149138 [[ " $output " != $' Cpus_allowed_list:\t ' " $first " ]]
150139 # XXX: For some reason, systemd-cgroup leads to us using the all-set
151140 # cpumask rather than the cpuset we configured?
152141 [ -v RUNC_USE_SYSTEMD ] || [[ " $output " == $' Cpus_allowed_list:\t ' " $second " ]]
153142}
154143
155144@test " runc exec [default CPU affinity should reset]" {
156- # We need to use RUNC_CMDLINE since taskset requires a proper binary, not a
157- # bash function (which is what runc and __runc are).
158- setup_runc_cmdline
159-
160145 first=" $( first_cpu) "
161146
162147 # Running without cpuset should result in an affinity for all CPUs.
163148 update_config ' .process.args = [ "/bin/sleep", "infinity" ]'
164149 update_config ' del(.linux.resources.cpu)'
165- sane_run taskset -c " $first " " ${RUNC_CMDLINE[@]} " run -d --console-socket " $CONSOLE_SOCKET " ctr3
166- [ " $status " -eq 0 ]
167- sane_run taskset -c " $first " " ${RUNC_CMDLINE[@]} " exec ctr3 grep -F Cpus_allowed_list: /proc/self/status
168- [ " $status " -eq 0 ]
150+ PRE_CMD=" taskset -c $first " runc -0 run -d --console-socket " $CONSOLE_SOCKET " ctr3
151+ PRE_CMD=" taskset -c $first " runc -0 exec ctr3 grep -F Cpus_allowed_list: /proc/self/status
169152 [[ " $output " != $' Cpus_allowed_list:\t ' " $first " ]]
170153 [[ " $output " == $' Cpus_allowed_list:\t ' " $INITIAL_CPU_MASK " ]]
171154}
@@ -174,20 +157,14 @@ function cpus_to_mask() {
174157 [ $EUID -ne 0 ] && requires rootless_cgroup
175158 set_cgroups_path
176159
177- # We need to use RUNC_CMDLINE since taskset requires a proper binary, not a
178- # bash function (which is what runc and __runc are).
179- setup_runc_cmdline
180-
181160 first=" $( first_cpu) "
182161 second=" $(( first + 1 )) " # Hacky; might not work in all environments.
183162
184163 # Running with a cpuset should result in an affinity that matches.
185164 update_config ' .process.args = [ "/bin/sleep", "infinity" ]'
186165 update_config ' .linux.resources.cpu = {"mems": "0", "cpus": "' " $first -$second " ' "}'
187- sane_run taskset -c " $first " " ${RUNC_CMDLINE[@]} " run -d --console-socket " $CONSOLE_SOCKET " ctr
188- [ " $status " -eq 0 ]
189- sane_run taskset -c " $first " " ${RUNC_CMDLINE[@]} " exec ctr grep -F Cpus_allowed_list: /proc/self/status
190- [ " $status " -eq 0 ]
166+ PRE_CMD=" taskset -c $first " runc -0 run -d --console-socket " $CONSOLE_SOCKET " ctr
167+ PRE_CMD=" taskset -c $first " runc -0 exec ctr grep -F Cpus_allowed_list: /proc/self/status
191168 [[ " $output " != $' Cpus_allowed_list:\t ' " $first " ]]
192169 # XXX: For some reason, systemd-cgroup leads to us using the all-set
193170 # cpumask rather than the cpuset we configured?
@@ -199,10 +176,8 @@ function cpus_to_mask() {
199176
200177 # Ditto for a cpuset that has no overlap with the original cpumask.
201178 update_config ' .linux.resources.cpu = {"mems": "0", "cpus": "' " $second " ' "}'
202- sane_run taskset -c " $first " " ${RUNC_CMDLINE[@]} " run -d --console-socket " $CONSOLE_SOCKET " ctr
203- [ " $status " -eq 0 ]
204- sane_run taskset -c " $first " " ${RUNC_CMDLINE[@]} " exec ctr grep -F Cpus_allowed_list: /proc/self/status
205- [ " $status " -eq 0 ]
179+ PRE_CMD=" taskset -c $first " runc -0 run -d --console-socket " $CONSOLE_SOCKET " ctr
180+ PRE_CMD=" taskset -c $first " runc -0 exec ctr grep -F Cpus_allowed_list: /proc/self/status
206181 [[ " $output " != $' Cpus_allowed_list:\t ' " $first " ]]
207182 # XXX: For some reason, systemd-cgroup leads to us using the all-set
208183 # cpumask rather than the cpuset we configured?
0 commit comments