code: def test_tar_add_dir():
      archive._make_dirs("test_add_dir/1/2/3")
  
      with open("test_add_dir/1/1.txt", "w") as f:
          f.write("1")
      with open("test_add_dir/1/2/2.txt", "w") as f:
          f.write("2")
      with open("test_add_dir/1/2/3/3.txt", "w") as f:
          f.write("3")
  
      tar_path = yatest.common.output_path("test_add_dir.tar")
      archive.tar("test_add_dir", tar_path)
  
      expected_tar_members = [
          "test_add_dir/1/1.txt",
          "test_add_dir/1/2/2.txt",
          "test_add_dir/1/2/3/3.txt",
      ]
  
      with tarfile.open(tar_path) as tar:
          for m in expected_tar_members:
              assert tar.getmember(m)
  
      tar_path = yatest.common.output_path("test_add_dir_2.tar")
      archive.tar([("test_add_dir", "root")], tar_path)
  
      expected_tar_members = [
          "root/1/1.txt",
          "root/1/2/2.txt",
          "root/1/2/3/3.txt",
      ]
  
      with tarfile.open(tar_path) as tar:
          for m in expected_tar_members:
              assert tar.getmember(m)
  
      tar_path = yatest.common.output_path("test_add_dir_3.tar")
      archive.tar([("test_add_dir", ".")], tar_path)
  
      expected_tar_members = ["1/1.txt", "1/2/2.txt", "1/2/3/3.txt"]
  
      with tarfile.open(tar_path) as tar:
          for m in expected_tar_members:
              assert tar.getmember(m)
  
imports: import errno
  import hashlib
  import os
  import shutil
  import socket
  import tarfile
  import threading
  import six
  import pytest
  import yatest.common
  import library.python.archive
label_desc: Use image node_id 8 for calling a global function with example usage: test_tar_add_dir() without return types