This file is indexed.

/usr/share/doc/charliecloud/html/install.html is in charliecloud-doc 0.2.3~git20171120.1a5609e-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>1. Installation &mdash; Charliecloud 0.2.3~pre documentation</title>
  

  
  
  
  

  

  
  
    

  

  
  
    <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  

  

  
        <link rel="search" title="Search" href="search.html"/>
        <link rel="copyright" title="Copyright" href="copyright.html"/>
    <link rel="top" title="Charliecloud 0.2.3~pre documentation" href="index.html"/>
        <link rel="next" title="2. Tutorial" href="tutorial.html"/>
        <link rel="prev" title="Overview" href="index.html"/> 

  
  <script src="_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav" role="document">

   
  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="index.html" class="icon icon-home"> Charliecloud
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">1. Installation</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#prequisites">1.1. Prequisites</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#run-time">1.1.1. Run time</a></li>
<li class="toctree-l3"><a class="reference internal" href="#build-time">1.1.2. Build time</a></li>
<li class="toctree-l3"><a class="reference internal" href="#test-suite">1.1.3. Test suite</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#docker-install-tips">1.2. Docker install tips</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#understand-the-security-implications-of-docker">1.2.1. Understand the security implications of Docker</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#docker-equals-root">1.2.1.1. <code class="code docutils literal"><span class="pre">docker</span></code> equals root</a></li>
<li class="toctree-l4"><a class="reference internal" href="#images-can-contain-bad-stuff">1.2.1.2. Images can contain bad stuff</a></li>
<li class="toctree-l4"><a class="reference internal" href="#containers-run-as-root">1.2.1.3. Containers run as root</a></li>
<li class="toctree-l4"><a class="reference internal" href="#docker-alters-your-network-configuration">1.2.1.4. Docker alters your network configuration</a></li>
<li class="toctree-l4"><a class="reference internal" href="#docker-installs-services">1.2.1.5. Docker installs services</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#configuring-for-a-proxy">1.2.2. Configuring for a proxy</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#install-charliecloud">1.3. Install Charliecloud</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#download">1.3.1. Download</a></li>
<li class="toctree-l3"><a class="reference internal" href="#build">1.3.2. Build</a></li>
<li class="toctree-l3"><a class="reference internal" href="#install-optional">1.3.3. Install (optional)</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#test-charliecloud">1.4. Test Charliecloud</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id1">1.4.1. Build</a></li>
<li class="toctree-l3"><a class="reference internal" href="#run">1.4.2. Run</a></li>
<li class="toctree-l3"><a class="reference internal" href="#examples">1.4.3. Examples</a></li>
<li class="toctree-l3"><a class="reference internal" href="#quick-and-multiple-phase-tests">1.4.4. Quick and multiple-phase tests</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="tutorial.html">2. Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="script-help.html">3. Help text for executables</a></li>
<li class="toctree-l1"><a class="reference internal" href="virtualbox.html">4. VirtualBox appliance</a></li>
<li class="toctree-l1"><a class="reference internal" href="faq.html">5. Frequently asked questions (FAQ)</a></li>
<li class="toctree-l1"><a class="reference internal" href="copyright.html">6. Copyright and license</a></li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">Charliecloud</a>
        
      </nav>


      
      <div class="wy-nav-content">
        <div class="rst-content">
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html">Docs</a> &raquo;</li>
        
      <li>1. Installation</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="installation">
<h1>1. Installation<a class="headerlink" href="#installation" title="Permalink to this headline"></a></h1>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last"><strong>If you are installing on a Cray</strong> and have not applied the patch for Cray
case #188073, you must use the <a class="reference external" href="https://github.com/hpc/charliecloud/compare/cray">cray branch</a> to avoid crashing
nodes during job completion. This is a Cray bug that Charliecloud happens
to tickle. Non-Cray build boxes and others at the same site can still use
the master branch.</p>
</div>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#prequisites" id="id2">Prequisites</a><ul>
<li><a class="reference internal" href="#run-time" id="id3">Run time</a></li>
<li><a class="reference internal" href="#build-time" id="id4">Build time</a></li>
<li><a class="reference internal" href="#test-suite" id="id5">Test suite</a></li>
</ul>
</li>
<li><a class="reference internal" href="#docker-install-tips" id="id6">Docker install tips</a><ul>
<li><a class="reference internal" href="#understand-the-security-implications-of-docker" id="id7">Understand the security implications of Docker</a></li>
<li><a class="reference internal" href="#configuring-for-a-proxy" id="id8">Configuring for a proxy</a></li>
</ul>
</li>
<li><a class="reference internal" href="#install-charliecloud" id="id9">Install Charliecloud</a><ul>
<li><a class="reference internal" href="#download" id="id10">Download</a></li>
<li><a class="reference internal" href="#build" id="id11">Build</a></li>
<li><a class="reference internal" href="#install-optional" id="id12">Install (optional)</a></li>
</ul>
</li>
<li><a class="reference internal" href="#test-charliecloud" id="id13">Test Charliecloud</a><ul>
<li><a class="reference internal" href="#id1" id="id14">Build</a></li>
<li><a class="reference internal" href="#run" id="id15">Run</a></li>
<li><a class="reference internal" href="#examples" id="id16">Examples</a></li>
<li><a class="reference internal" href="#quick-and-multiple-phase-tests" id="id17">Quick and multiple-phase tests</a></li>
</ul>
</li>
</ul>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">These are general installation instructions. If you’d like specific,
step-by-step directions for CentOS 7, section <a class="reference internal" href="virtualbox.html"><span class="doc">VirtualBox appliance</span></a> has these
for a VirtualBox virtual machine.</p>
</div>
<div class="section" id="prequisites">
<h2><a class="toc-backref" href="#id2">1.1. Prequisites</a><a class="headerlink" href="#prequisites" title="Permalink to this headline"></a></h2>
<p>Charliecloud is a simple system with limited prerequisites. If your system
meets these prerequisites but Charliecloud doesn’t work, please report that as
a bug.</p>
<div class="section" id="run-time">
<h3><a class="toc-backref" href="#id3">1.1.1. Run time</a><a class="headerlink" href="#run-time" title="Permalink to this headline"></a></h3>
<p>Systems used for running images in the standard unprivileged mode need:</p>
<ul class="simple">
<li>Recent Linux kernel with <code class="code docutils literal"><span class="pre">CONFIG_USER_NS=y</span></code>. We recommend version 4.4
or higher.</li>
<li>C compiler and standard library</li>
<li>POSIX shell and utilities</li>
</ul>
<p>Some distributions need configuration changes to enable user namespaces. For
example, Debian Stretch needs sysctl
<code class="code docutils literal"><span class="pre">kernel.unprivileged_userns_clone=1</span></code>, and RHEL and CentOS 7.4 need both
a <a class="reference external" href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_atomic_host/7/html-single/getting_started_with_containers/#user_namespaces_options">kernel command line option and a sysctl</a>
(that put you into “technology preview”).</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">An experimental setuid mode is also provided that does not need user
namespaces. This should run on most currently supported Linux
distributions.</p>
</div>
</div>
<div class="section" id="build-time">
<h3><a class="toc-backref" href="#id4">1.1.2. Build time</a><a class="headerlink" href="#build-time" title="Permalink to this headline"></a></h3>
<p>Systems used for building images need the run-time prerequisites, plus:</p>
<ul class="simple">
<li>Bash 4.1+</li>
</ul>
<p>and optionally:</p>
<ul class="simple">
<li><a class="reference external" href="https://www.docker.com/">Docker</a> 17.03+</li>
<li>internet access or Docker configured for a local Docker hub</li>
<li>root access using <code class="code docutils literal"><span class="pre">sudo</span></code></li>
</ul>
<p>Older versions of Docker may work but are untested. We know that 1.7.1 does
not work.</p>
</div>
<div class="section" id="test-suite">
<h3><a class="toc-backref" href="#id5">1.1.3. Test suite</a><a class="headerlink" href="#test-suite" title="Permalink to this headline"></a></h3>
<p>In order to run the test suite on a run or build system (you can test each
mode independently), you also need:</p>
<ul class="simple">
<li>Bash 4.1+</li>
<li>Python 2.6+</li>
<li><a class="reference external" href="https://github.com/sstephenson/bats">Bats</a> 0.4.0</li>
<li>wget</li>
</ul>
<p>Note that without Docker on the build system, some of the test suite will be
skipped.</p>
<p>Bats can be installed at the system level or embedded in the Charliecloud
source code. If it’s in both places, the latter is used.</p>
<p>To embed Bats, either:</p>
<ul class="simple">
<li>Download Charliecloud using <code class="code docutils literal"><span class="pre">git</span> <span class="pre">clone</span> <span class="pre">--recursive</span></code>, which will check
out Bats as a submodule in <code class="code docutils literal"><span class="pre">test/bats</span></code>.</li>
<li>Unpack the Bats zip file or tarball in <code class="code docutils literal"><span class="pre">test/bats</span></code>.</li>
</ul>
<p>To check an embedded Bats:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> test/bats/bin/bats --version
<span class="go">Bats 0.4.0</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="docker-install-tips">
<h2><a class="toc-backref" href="#id6">1.2. Docker install tips</a><a class="headerlink" href="#docker-install-tips" title="Permalink to this headline"></a></h2>
<p>Tnstalling Docker is beyond the scope of this documentation, but here are a
few tips.</p>
<div class="section" id="understand-the-security-implications-of-docker">
<h3><a class="toc-backref" href="#id7">1.2.1. Understand the security implications of Docker</a><a class="headerlink" href="#understand-the-security-implications-of-docker" title="Permalink to this headline"></a></h3>
<p>Because Docker (a) makes installing random crap from the internet really easy
and (b) is easy to deploy insecurely, you should take care. Some of the
implications are below. This list should not be considered comprehensive nor a
substitute for appropriate expertise; adhere to your moral and institutional
responsibilities.</p>
<div class="section" id="docker-equals-root">
<h4>1.2.1.1. <code class="code docutils literal"><span class="pre">docker</span></code> equals root<a class="headerlink" href="#docker-equals-root" title="Permalink to this headline"></a></h4>
<p>Anyone who can run the <code class="code docutils literal"><span class="pre">docker</span></code> command or interact with the Docker
daemon can <a class="reference external" href="http://reventlov.com/advisories/using-the-docker-command-to-root-the-host">trivially escalate to root</a>.
This is considered a feature.</p>
<p>For this reason, don’t create the <code class="code docutils literal"><span class="pre">docker</span></code> group, as this will allow
passwordless, unlogged escalation for anyone in the group.</p>
</div>
<div class="section" id="images-can-contain-bad-stuff">
<h4>1.2.1.2. Images can contain bad stuff<a class="headerlink" href="#images-can-contain-bad-stuff" title="Permalink to this headline"></a></h4>
<p>Standard hygiene for “installing stuff from the internet” applies. Only work
with images you trust. The official Docker Hub repositories can help.</p>
</div>
<div class="section" id="containers-run-as-root">
<h4>1.2.1.3. Containers run as root<a class="headerlink" href="#containers-run-as-root" title="Permalink to this headline"></a></h4>
<p>By default, Docker runs container processes as root. In addition to being poor
hygiene, this can be an escalation path, e.g. if you bind-mount host
directories.</p>
</div>
<div class="section" id="docker-alters-your-network-configuration">
<h4>1.2.1.4. Docker alters your network configuration<a class="headerlink" href="#docker-alters-your-network-configuration" title="Permalink to this headline"></a></h4>
<p>To see what it did:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> ifconfig    <span class="c1"># note docker0 interface</span>
<span class="gp">$</span> brctl show  <span class="c1"># note docker0 bridge</span>
<span class="gp">$</span> route -n
</pre></div>
</div>
</div>
<div class="section" id="docker-installs-services">
<h4>1.2.1.5. Docker installs services<a class="headerlink" href="#docker-installs-services" title="Permalink to this headline"></a></h4>
<p>If you don’t want the service starting automatically at boot, e.g.:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> systemctl is-enabled docker
<span class="go">enabled</span>
<span class="gp">$</span> systemctl disable docker
<span class="gp">$</span> systemctl is-enabled docker
<span class="go">disabled</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="configuring-for-a-proxy">
<h3><a class="toc-backref" href="#id8">1.2.2. Configuring for a proxy</a><a class="headerlink" href="#configuring-for-a-proxy" title="Permalink to this headline"></a></h3>
<p>By default, Docker does not work if you have a proxy, and it fails in two
different ways.</p>
<p>The first problem is that Docker itself must be told to use a proxy. This
manifests as:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> sudo docker run hello-world
<span class="go">Unable to find image &#39;hello-world:latest&#39; locally</span>
<span class="go">Pulling repository hello-world</span>
<span class="go">Get https://index.docker.io/v1/repositories/library/hello-world/images: dial tcp 54.152.161.54:443: connection refused</span>
</pre></div>
</div>
<p>If you have a systemd system, the <a class="reference external" href="https://docs.docker.com/engine/admin/systemd/#http-proxy">Docker documentation</a> explains how to
configure this. If you don’t have a systemd system, then
<code class="code docutils literal"><span class="pre">/etc/default/docker</span></code> might be the place to go?</p>
<p>The second problem is that Docker containers need to know about the proxy as
well. This manifests as images failing to build because they can’t download
stuff from the internet.</p>
<p>The fix is to set the proxy variables in your environment, e.g.:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="go">export HTTP_PROXY=http://proxy.example.com:8088</span>
<span class="go">export http_proxy=$HTTP_PROXY</span>
<span class="go">export HTTPS_PROXY=$HTTP_PROXY</span>
<span class="go">export https_proxy=$HTTP_PROXY</span>
<span class="go">export ALL_PROXY=$HTTP_PROXY</span>
<span class="go">export all_proxy=$HTTP_PROXY</span>
<span class="go">export NO_PROXY=&#39;localhost,127.0.0.1,.example.com&#39;</span>
<span class="go">export no_proxy=$NO_PROXY</span>
</pre></div>
</div>
<p>You also need to teach <code class="code docutils literal"><span class="pre">sudo</span></code> to retain them. Add the following to
<code class="code docutils literal"><span class="pre">/etc/sudoers</span></code>:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="go">Defaults env_keep+=&quot;HTTP_PROXY http_proxy HTTPS_PROXY https_proxy ALL_PROXY all_proxy NO_PROXY no_proxy&quot;</span>
</pre></div>
</div>
<p>Because different programs use different subsets of these variables, and to
avoid a situation where some things work and others don’t, the Charliecloud
test suite (see below) includes a test that fails if some but not all of the
above variables are set.</p>
</div>
</div>
<div class="section" id="install-charliecloud">
<h2><a class="toc-backref" href="#id9">1.3. Install Charliecloud</a><a class="headerlink" href="#install-charliecloud" title="Permalink to this headline"></a></h2>
<div class="section" id="download">
<h3><a class="toc-backref" href="#id10">1.3.1. Download</a><a class="headerlink" href="#download" title="Permalink to this headline"></a></h3>
<p>See our GitHub project: <a class="reference external" href="https://github.com/hpc/charliecloud">https://github.com/hpc/charliecloud</a></p>
<p>The recommended download method is <code class="code docutils literal"><span class="pre">git</span> <span class="pre">clone</span> <span class="pre">--recursive</span></code>.</p>
</div>
<div class="section" id="build">
<h3><a class="toc-backref" href="#id11">1.3.2. Build</a><a class="headerlink" href="#build" title="Permalink to this headline"></a></h3>
<p>To build in the standard, unprivileged mode (recommended):</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> make
</pre></div>
</div>
<p>To build in setuid mode (for testing if your kernel doesn’t support the user
namespace):</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> make <span class="nv">SETUID</span><span class="o">=</span>yes
</pre></div>
</div>
<p>To build the documentation, see <code class="code docutils literal"><span class="pre">doc-src/README</span></code>.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Do not build as root. This is unsupported and may introduce security
problems.</p>
</div>
</div>
<div class="section" id="install-optional">
<h3><a class="toc-backref" href="#id12">1.3.3. Install (optional)</a><a class="headerlink" href="#install-optional" title="Permalink to this headline"></a></h3>
<p>You can run Charliecloud from the source directory, and it’s recommended you
at least run the test suite before installation to establish that your system
will work.</p>
<p>To install (FHS-compliant):</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> make install <span class="nv">PREFIX</span><span class="o">=</span>/foo/bar
</pre></div>
</div>
<p>Note that <code class="code docutils literal"><span class="pre">PREFIX</span></code> is required; it does not default to
<code class="code docutils literal"><span class="pre">/usr/local</span></code> like many packages.</p>
</div>
</div>
<div class="section" id="test-charliecloud">
<span id="install-test-charliecloud"></span><h2><a class="toc-backref" href="#id13">1.4. Test Charliecloud</a><a class="headerlink" href="#test-charliecloud" title="Permalink to this headline"></a></h2>
<p>Charliecloud comes with a fairly comprehensive Bats test suite, in
<code class="code docutils literal"><span class="pre">test</span></code>. Go there:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> <span class="nb">cd</span> <span class="nb">test</span>
</pre></div>
</div>
<p>To check location and version of Bats used by the tests:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> make where-bats
<span class="go">which bats</span>
<span class="go">/usr/bin/bats</span>
<span class="go">bats --version</span>
<span class="go">Bats 0.4.0</span>
</pre></div>
</div>
<p>Just like for normal use, the Charliecloud test suite is split into build and
run phases, and there is an additional phase that runs the examples’ test
suites. These phases can be tested independently on different systems.</p>
<p>Testing is coordinated by <code class="code docutils literal"><span class="pre">make</span></code>. The test targets run one or more test
suites. If any test suite has a failure, testing stops with an error message.</p>
<p>The tests need three work directories with several gigabytes of free space, in
order to store image tarballs, unpacked image directories, and permission test
fixtures. These are configured with environment variables:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> <span class="nb">export</span> <span class="nv">CH_TEST_TARDIR</span><span class="o">=</span>/var/tmp/tarballs
<span class="gp">$</span> <span class="nb">export</span> <span class="nv">CH_TEST_IMGDIR</span><span class="o">=</span>/var/tmp/images
<span class="gp">$</span> <span class="nb">export</span> <span class="nv">CH_TEST_PERMDIRS</span><span class="o">=</span><span class="s1">&#39;/var/tmp /tmp&#39;</span>
</pre></div>
</div>
<p><code class="code docutils literal"><span class="pre">CH_TEST_PERMDIRS</span></code> can be set to <code class="code docutils literal"><span class="pre">skip</span></code> in order to skip the file
permissions tests.</p>
<p>(Strictly speaking, the build phase needs only the first, and the example test
phase does not need the last one. However, for simplicity, the tests will
demand all three for all phases.)</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Bats will wait until all descendant processes finish before exiting, so if
you get into a failure mode where a test suite doesn’t clean up all its
processes, Bats will hang.</p>
</div>
<div class="section" id="id1">
<h3><a class="toc-backref" href="#id14">1.4.1. Build</a><a class="headerlink" href="#id1" title="Permalink to this headline"></a></h3>
<p>In this phase, image building and associated functionality is tested.</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> make test-build
<span class="go">bats build.bats build_auto.bats build_post.bats</span>
<span class="go"> ✓ create tarball directory if needed</span>
<span class="go"> ✓ documentations build</span>
<span class="go"> ✓ executables seem sane</span>
<span class="go">[...]</span>
<span class="go"> ✓ ch-build obspy</span>
<span class="go"> ✓ ch-docker2tar obspy</span>
<span class="go"> ✓ docker pull dockerpull</span>
<span class="go"> ✓ ch-docker2tar dockerpull</span>
<span class="go"> ✓ nothing unexpected in tarball directory</span>

<span class="go">41 tests, 0 failures</span>
</pre></div>
</div>
<p>Note that with an empty Docker cache, this test can be quite lengthy, half an
hour or more, because it builds all the examples as well as several basic
Dockerfiles for common Linux distributions and tools (in <code class="code docutils literal"><span class="pre">test</span></code>). With a
full cache, expect more like 1–2 minutes.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>The easiest way to update the Docker images used in this test is to simply
delete all Docker containers and images, and let them be rebuilt:</p>
<div class="last highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> sudo docker rm <span class="k">$(</span>sudo docker ps -aq<span class="k">)</span>
<span class="gp">$</span> sudo docker rmi -f <span class="k">$(</span>sudo docker images -q<span class="k">)</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="run">
<h3><a class="toc-backref" href="#id15">1.4.2. Run</a><a class="headerlink" href="#run" title="Permalink to this headline"></a></h3>
<p>The run tests require the contents of <code class="code docutils literal"><span class="pre">$CH_TEST_TARDIR</span></code> produced by a
successful, complete build test. Copy this directory to the run
system.</p>
<p>Additionally, the user running the tests needs to be a member of at least 2
groups.</p>
<p>File permission enforcement is tested against specially constructed fixture
directories. These should include every meaningful mounted filesystem, and
they cannot be shared between different users. To create them:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> <span class="k">for</span> d in <span class="nv">$CH_TEST_PERMDIRS</span><span class="p">;</span> <span class="k">do</span> sudo ./make-perms-test <span class="nv">$d</span> <span class="nv">$USER</span> nobody<span class="p">;</span> <span class="k">done</span>
</pre></div>
</div>
<p>To skip this test (e.g., if you don’t have root), set
<code class="code docutils literal"><span class="pre">$CH_TEST_PERMDIRS</span></code> to <code class="code docutils literal"><span class="pre">skip</span></code>.</p>
<p>To run the tests:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> make test-run
</pre></div>
</div>
</div>
<div class="section" id="examples">
<h3><a class="toc-backref" href="#id16">1.4.3. Examples</a><a class="headerlink" href="#examples" title="Permalink to this headline"></a></h3>
<p>Some of the examples include test suites of their own. This Charliecloud runs
those test suites, using a Slurm allocation if one is available or a single
node (localhost) if not.</p>
<p>These require that the run tests have been completed successfully.</p>
<p>Note that this test can take quite a while, and that single tests from
the Charliecloud perspective include entire test suites from the example’s
perspective, so be patient.</p>
<p>To run the tests:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> make test-test
</pre></div>
</div>
</div>
<div class="section" id="quick-and-multiple-phase-tests">
<h3><a class="toc-backref" href="#id17">1.4.4. Quick and multiple-phase tests</a><a class="headerlink" href="#quick-and-multiple-phase-tests" title="Permalink to this headline"></a></h3>
<p>We also provide the following additional test targets:</p>
<blockquote>
<div><ul class="simple">
<li><code class="code docutils literal"><span class="pre">test-quick</span></code>: key subset of build and run phases (nice for development)</li>
<li><code class="code docutils literal"><span class="pre">test</span></code>: build and run phases</li>
<li><code class="code docutils literal"><span class="pre">test-all</span></code>: all three phases</li>
</ul>
</div></blockquote>
<p>We recommend that a build box pass all phases so it can be used to run
containers for testing and development.</p>
</div>
</div>
</div>


           </div>
           <div class="articleComments">
            
           </div>
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="tutorial.html" class="btn btn-neutral float-right" title="2. Tutorial" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="index.html" class="btn btn-neutral" title="Overview" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; <a href="copyright.html">Copyright</a> 2014–2017, Los Alamos National Security, LLC.

    </p>
  </div> 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'./',
            VERSION:'0.2.3~pre',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  true,
            SOURCELINK_SUFFIX: '.txt'
        };
    </script>
      <script type="text/javascript" src="_static/jquery.js"></script>
      <script type="text/javascript" src="_static/underscore.js"></script>
      <script type="text/javascript" src="_static/doctools.js"></script>
      <script type="text/javascript" src="/usr/share/javascript/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

  

  
  
    <script type="text/javascript" src="_static/js/theme.js"></script>
  

  
  
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      });
  </script>
   

</body>
</html>