code: def test_glob_archive(archives, glob, expected, sort_results=False):
      output = StringIO.StringIO()
      ## replace placeholders
      glob = glob.replace("$archive1", archives[0]).replace(
          "$obj", obj_suffix
      )
      expected = [
          m.replace("$archive1", archives[0]).replace(
              "$obj", obj_suffix
          )
          for m in expected
      ]
      if len(archives) > 1:
          glob = glob.replace("$archive2", archives[1]).replace(
              "$obj", obj_suffix
          )
          expected = [
              m.replace("$archive2", archives[1]).replace(
                  "$obj", obj_suffix
              )
              for m in expected
          ]
      ## create test jamfile
      if sort_results:
          glob = "[ SORT %s ]" % glob
      output.write(
          """\
      for local p in %s
      {
          ECHO $(p) ;
      }
      UPDATE ;
      """
          % glob
      )
      t.write("file.jam", output.getvalue())
      ## run test jamfile and match against expected results
      if sort_results:
          expected.sort()
      t.run_build_system(
          ["-ffile.jam"], stdout="\n".join(expected + [""])
      )
      t.rm("file.jam")
  
imports: import os
  import sys
  import StringIO
  import BoostBuild
label_desc: Use image node_id 3 for calling a global function with example usage: test_glob_archive(archives, glob, expected, sort_results) without return types