code: def test_raw_nt(n=None, error=False):
      t = BoostBuild.Tester(
          ["-d1", "-d+4"], pass_toolset=0, use_test_config=False
      )
  
      cmd_prefix = "%s -c \"print('XXX: " % executable
      cmd_suffix = "')\""
      cmd_extra_length = len(cmd_prefix) + len(cmd_suffix)
  
      if n == None:
          n = cmd_extra_length
  
      data_length = n - cmd_extra_length
      if data_length < 0:
          BoostBuild.annotation(
              "failure",
              """\
  Can not construct Windows command of desired length. Requested command length
  too short for the current test configuration.
      Requested command length: %d
      Minimal supported command length: %d
  """
              % (n, cmd_extra_length),
          )
          t.fail_test(1, dump_difference=False)
  
      #   Each $(Xx10-1) variable contains X words of 9 characters each, which,
      # including spaces between words, brings the total number of characters in
      # its string representation to X * 10 - 1 (X * 9 characters + (X - 1)
      # spaces).
      t.write(
          "file.jam",
          """\
  ten = 0 1 2 3 4 5 6 7 8 9 ;
  
  1x10-1 = 123456789 ;
  10x10-1 = $(ten)12345678 ;
  100x10-1 = $(ten)$(ten)1234567 ;
  1000x10-1 = $(ten)$(ten)$(ten)123456 ;
  
  actions do_echo
  {
      %s%s%s
  }
  JAMSHELL = %% ;
  do_echo all ;
  """
          % (cmd_prefix, string_of_length(data_length), cmd_suffix),
      )
      if error:
          expected_status = 1
      else:
          expected_status = 0
      t.run_build_system(["-ffile.jam"], status=expected_status)
      if error:
          t.expect_output_lines("Executing raw command directly", False)
          t.expect_output_lines(
              "do_echo action is too long (%d, max 32766):" % n
          )
          t.expect_output_lines("XXX: *", False)
      else:
          t.expect_output_lines("Executing raw command directly")
          t.expect_output_lines("do_echo action is too long*", False)
  
          m = re.search("^XXX: (.*)$", t.stdout(), re.MULTILINE)
          if not m:
              BoostBuild.annotation(
                  "failure",
                  "Expected output line starting "
                  "with 'XXX: ' not found.",
              )
              t.fail_test(1, dump_difference=False)
          if len(m.group(1)) != data_length:
              BoostBuild.annotation(
                  "failure",
                  """Unexpected output data length.
      Expected: %d
      Received: %d"""
                  % (n, len(m.group(1))),
              )
              t.fail_test(1, dump_difference=False)
  
      t.cleanup()
  
imports: import BoostBuild
  import os
  import re
  import sys
label_desc: Use image node_id 3 for calling a global function with example usage: test_raw_nt(n, error) without return types