[llvm] r221137 - [OCaml] Run tests twice, with ocamlc and ocamlopt (if available)

Hal Finkel hfinkel at anl.gov
Mon Nov 3 14:55:24 PST 2014


----- Original Message -----
> From: "Peter Zotov" <whitequark at whitequark.org>
> To: llvm-commits at cs.uiuc.edu
> Sent: Monday, November 3, 2014 3:51:08 AM
> Subject: [llvm] r221137 - [OCaml] Run tests twice,	with ocamlc and ocamlopt (if available)
> 
> Author: whitequark
> Date: Mon Nov  3 03:50:53 2014
> New Revision: 221137
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=221137&view=rev
> Log:
> [OCaml] Run tests twice, with ocamlc and ocamlopt (if available)
> 
> ocamlc and ocamlopt expose a distinct set of buildsystem bugs, e.g.
> only ocamlc would detect -custom or -dllib-related bugs, and as all
> buildbots will have ocamlopt, these bugs will stay hidden.
> 
> This change should add no more than 30 seconds of testing time.
> 
> Modified:
>     llvm/trunk/test/Bindings/OCaml/analysis.ml
>     llvm/trunk/test/Bindings/OCaml/bitreader.ml
>     llvm/trunk/test/Bindings/OCaml/bitwriter.ml
>     llvm/trunk/test/Bindings/OCaml/core.ml
>     llvm/trunk/test/Bindings/OCaml/executionengine.ml
>     llvm/trunk/test/Bindings/OCaml/ext_exc.ml
>     llvm/trunk/test/Bindings/OCaml/ipo.ml
>     llvm/trunk/test/Bindings/OCaml/irreader.ml
>     llvm/trunk/test/Bindings/OCaml/linker.ml
>     llvm/trunk/test/Bindings/OCaml/passmgr_builder.ml
>     llvm/trunk/test/Bindings/OCaml/scalar_opts.ml
>     llvm/trunk/test/Bindings/OCaml/target.ml
>     llvm/trunk/test/Bindings/OCaml/vectorize.ml
>     llvm/trunk/test/lit.cfg
> 
> Modified: llvm/trunk/test/Bindings/OCaml/analysis.ml
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/OCaml/analysis.ml?rev=221137&r1=221136&r2=221137&view=diff
> ==============================================================================
> --- llvm/trunk/test/Bindings/OCaml/analysis.ml (original)
> +++ llvm/trunk/test/Bindings/OCaml/analysis.ml Mon Nov  3 03:50:53
> 2014
> @@ -1,5 +1,7 @@
>  (* RUN: cp %s %T/analysis.ml
> - * RUN: %ocamlcomp -g -warn-error A -package llvm.analysis -linkpkg
> %T/analysis.ml -o %t
> + * RUN: %ocamlc -g -warn-error A -package llvm.analysis -linkpkg
> %T/analysis.ml -o %t
> + * RUN: %t
> + * RUN: %ocamlopt -g -warn-error A -package llvm.analysis -linkpkg
> %T/analysis.ml -o %t
>   * RUN: %t
>   * XFAIL: vg_leak
>   *)
> 
> Modified: llvm/trunk/test/Bindings/OCaml/bitreader.ml
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/OCaml/bitreader.ml?rev=221137&r1=221136&r2=221137&view=diff
> ==============================================================================
> --- llvm/trunk/test/Bindings/OCaml/bitreader.ml (original)
> +++ llvm/trunk/test/Bindings/OCaml/bitreader.ml Mon Nov  3 03:50:53
> 2014
> @@ -1,5 +1,7 @@
>  (* RUN: cp %s %T/bitreader.ml
> - * RUN: %ocamlcomp -g -warn-error A -package llvm.bitreader -package
> llvm.bitwriter -linkpkg %T/bitreader.ml -o %t
> + * RUN: %ocamlc -g -warn-error A -package llvm.bitreader -package
> llvm.bitwriter -linkpkg %T/bitreader.ml -o %t
> + * RUN: %t %t.bc
> + * RUN: %ocamlopt -g -warn-error A -package llvm.bitreader -package
> llvm.bitwriter -linkpkg %T/bitreader.ml -o %t
>   * RUN: %t %t.bc
>   * RUN: llvm-dis < %t.bc
>   * XFAIL: vg_leak
> 
> Modified: llvm/trunk/test/Bindings/OCaml/bitwriter.ml
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/OCaml/bitwriter.ml?rev=221137&r1=221136&r2=221137&view=diff
> ==============================================================================
> --- llvm/trunk/test/Bindings/OCaml/bitwriter.ml (original)
> +++ llvm/trunk/test/Bindings/OCaml/bitwriter.ml Mon Nov  3 03:50:53
> 2014
> @@ -1,5 +1,7 @@
>  (* RUN: cp %s %T/bitwriter.ml
> - * RUN: %ocamlcomp -g -warn-error A -package llvm.bitreader -package
> llvm.bitwriter -linkpkg %T/bitwriter.ml -o %t
> + * RUN: %ocamlc -g -w -3 -warn-error A -package llvm.bitreader
> -package llvm.bitwriter -linkpkg %T/bitwriter.ml -o %t
> + * RUN: %t %t.bc
> + * RUN: %ocamlopt -g -w -3 -warn-error A -package llvm.bitreader
> -package llvm.bitwriter -linkpkg %T/bitwriter.ml -o %t
>   * RUN: %t %t.bc
>   * RUN: llvm-dis < %t.bc
>   * XFAIL: vg_leak
> 
> Modified: llvm/trunk/test/Bindings/OCaml/core.ml
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/OCaml/core.ml?rev=221137&r1=221136&r2=221137&view=diff
> ==============================================================================
> --- llvm/trunk/test/Bindings/OCaml/core.ml (original)
> +++ llvm/trunk/test/Bindings/OCaml/core.ml Mon Nov  3 03:50:53 2014
> @@ -1,5 +1,7 @@
> -(* RUN: cp %s %T/vmcore.ml
> - * RUN: %ocamlcomp -g -warn-error A -package llvm.analysis -package
> llvm.bitwriter -linkpkg %T/vmcore.ml -o %t
> +(* RUN: cp %s %T/core.ml
> + * RUN: %ocamlc -g -warn-error A -package llvm.analysis -package
> llvm.bitwriter -linkpkg %T/core.ml -o %t
> + * RUN: %t %t.bc
> + * RUN: %ocamlopt -g -warn-error A -package llvm.analysis -package
> llvm.bitwriter -linkpkg %T/core.ml -o %t
>   * RUN: %t %t.bc
>   * RUN: llvm-dis < %t.bc > %t.ll
>   * RUN: FileCheck %s < %t.ll
> 
> Modified: llvm/trunk/test/Bindings/OCaml/executionengine.ml
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/OCaml/executionengine.ml?rev=221137&r1=221136&r2=221137&view=diff
> ==============================================================================
> --- llvm/trunk/test/Bindings/OCaml/executionengine.ml (original)
> +++ llvm/trunk/test/Bindings/OCaml/executionengine.ml Mon Nov  3
> 03:50:53 2014
> @@ -1,5 +1,7 @@
>  (* RUN: cp %s %T/executionengine.ml
> - * RUN: %ocamlcomp -g -warn-error A -package llvm.executionengine
> -linkpkg %T/executionengine.ml -o %t
> + * RUN: %ocamlc -g -warn-error A -package llvm.executionengine
> -linkpkg %T/executionengine.ml -o %t
> + * RUN: %t
> + * RUN: %ocamlopt -g -warn-error A -package llvm.executionengine
> -linkpkg %T/executionengine.ml -o %t
>   * RUN: %t
>   * REQUIRES: native, object-emission
>   * XFAIL: vg_leak
> 
> Modified: llvm/trunk/test/Bindings/OCaml/ext_exc.ml
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/OCaml/ext_exc.ml?rev=221137&r1=221136&r2=221137&view=diff
> ==============================================================================
> --- llvm/trunk/test/Bindings/OCaml/ext_exc.ml (original)
> +++ llvm/trunk/test/Bindings/OCaml/ext_exc.ml Mon Nov  3 03:50:53
> 2014
> @@ -1,5 +1,7 @@
>  (* RUN: cp %s %T/ext_exc.ml
> - * RUN: %ocamlcomp -g -warn-error A -package llvm.bitreader -linkpkg
> %T/ext_exc.ml -o %t
> + * RUN: %ocamlc -g -warn-error A -package llvm.bitreader -linkpkg
> %T/ext_exc.ml -o %t
> + * RUN: %t
> + * RUN: %ocamlopt -g -warn-error A -package llvm.bitreader -linkpkg
> %T/ext_exc.ml -o %t
>   * RUN: %t
>   * XFAIL: vg_leak
>   *)
> 
> Modified: llvm/trunk/test/Bindings/OCaml/ipo.ml
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/OCaml/ipo.ml?rev=221137&r1=221136&r2=221137&view=diff
> ==============================================================================
> --- llvm/trunk/test/Bindings/OCaml/ipo.ml (original)
> +++ llvm/trunk/test/Bindings/OCaml/ipo.ml Mon Nov  3 03:50:53 2014
> @@ -1,5 +1,7 @@
>  (* RUN: cp %s %T/ipo_opts.ml
> - * RUN: %ocamlcomp -g -warn-error A -package llvm.ipo -linkpkg
> %T/ipo_opts.ml -o %t
> + * RUN: %ocamlc -g -warn-error A -package llvm.ipo -linkpkg
> %T/ipo_opts.ml -o %t
> + * RUN: %t %t.bc
> + * RUN: %ocamlopt -g -warn-error A -package llvm.ipo -linkpkg
> %T/ipo_opts.ml -o %t
>   * RUN: %t %t.bc
>   * XFAIL: vg_leak
>   *)
> 
> Modified: llvm/trunk/test/Bindings/OCaml/irreader.ml
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/OCaml/irreader.ml?rev=221137&r1=221136&r2=221137&view=diff
> ==============================================================================
> --- llvm/trunk/test/Bindings/OCaml/irreader.ml (original)
> +++ llvm/trunk/test/Bindings/OCaml/irreader.ml Mon Nov  3 03:50:53
> 2014
> @@ -1,5 +1,7 @@
>  (* RUN: cp %s %T/irreader.ml
> - * RUN: %ocamlcomp -g -warn-error A -package llvm.irreader -linkpkg
> %T/irreader.ml -o %t
> + * RUN: %ocamlc -g -warn-error A -package llvm.irreader -linkpkg
> %T/irreader.ml -o %t
> + * RUN: %t
> + * RUN: %ocamlopt -g -warn-error A -package llvm.irreader -linkpkg
> %T/irreader.ml -o %t
>   * RUN: %t
>   * XFAIL: vg_leak
>   *)
> 
> Modified: llvm/trunk/test/Bindings/OCaml/linker.ml
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/OCaml/linker.ml?rev=221137&r1=221136&r2=221137&view=diff
> ==============================================================================
> --- llvm/trunk/test/Bindings/OCaml/linker.ml (original)
> +++ llvm/trunk/test/Bindings/OCaml/linker.ml Mon Nov  3 03:50:53 2014
> @@ -1,5 +1,7 @@
>  (* RUN: cp %s %T/linker.ml
> - * RUN: %ocamlcomp -g -warn-error A -package llvm.linker -linkpkg
> %T/linker.ml -o %t
> + * RUN: %ocamlc -g -warn-error A -package llvm.linker -linkpkg
> %T/linker.ml -o %t
> + * RUN: %t
> + * RUN: %ocamlopt -g -warn-error A -package llvm.linker -linkpkg
> %T/linker.ml -o %t
>   * RUN: %t
>   * XFAIL: vg_leak
>   *)
> 
> Modified: llvm/trunk/test/Bindings/OCaml/passmgr_builder.ml
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/OCaml/passmgr_builder.ml?rev=221137&r1=221136&r2=221137&view=diff
> ==============================================================================
> --- llvm/trunk/test/Bindings/OCaml/passmgr_builder.ml (original)
> +++ llvm/trunk/test/Bindings/OCaml/passmgr_builder.ml Mon Nov  3
> 03:50:53 2014
> @@ -1,5 +1,7 @@
>  (* RUN: cp %s %T/passmgr_builder.ml
> - * RUN: %ocamlcomp -g -warn-error A -package llvm.passmgr_builder
> -linkpkg %T/passmgr_builder.ml -o %t
> + * RUN: %ocamlc -g -warn-error A -package llvm.passmgr_builder
> -linkpkg %T/passmgr_builder.ml -o %t
> + * RUN: %t %t.bc
> + * RUN: %ocamlopt -g -warn-error A -package llvm.passmgr_builder
> -linkpkg %T/passmgr_builder.ml -o %t
>   * RUN: %t %t.bc
>   * XFAIL: vg_leak
>   *)
> 
> Modified: llvm/trunk/test/Bindings/OCaml/scalar_opts.ml
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/OCaml/scalar_opts.ml?rev=221137&r1=221136&r2=221137&view=diff
> ==============================================================================
> --- llvm/trunk/test/Bindings/OCaml/scalar_opts.ml (original)
> +++ llvm/trunk/test/Bindings/OCaml/scalar_opts.ml Mon Nov  3 03:50:53
> 2014
> @@ -1,5 +1,7 @@
>  (* RUN: cp %s %T/scalar_opts.ml
> - * RUN: %ocamlcomp -g -warn-error A -package llvm.scalar_opts
> -linkpkg %T/scalar_opts.ml -o %t
> + * RUN: %ocamlc -g -warn-error A -package llvm.scalar_opts -linkpkg
> %T/scalar_opts.ml -o %t
> + * RUN: %t %t.bc
> + * RUN: %ocamlopt -g -warn-error A -package llvm.scalar_opts
> -linkpkg %T/scalar_opts.ml -o %t
>   * RUN: %t %t.bc
>   * XFAIL: vg_leak
>   *)
> 
> Modified: llvm/trunk/test/Bindings/OCaml/target.ml
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/OCaml/target.ml?rev=221137&r1=221136&r2=221137&view=diff
> ==============================================================================
> --- llvm/trunk/test/Bindings/OCaml/target.ml (original)
> +++ llvm/trunk/test/Bindings/OCaml/target.ml Mon Nov  3 03:50:53 2014
> @@ -1,5 +1,6 @@
>  (* RUN: cp %s %T/target.ml
> - * RUN: %ocamlcomp -g -warn-error A -package llvm.target -package
> llvm.all_backends -linkpkg %T/target.ml -o %t
> + * RUN: %ocamlc -g -warn-error A -package llvm.target -package
> llvm.all_backends -linkpkg %T/target.ml -o %t
> + * RUN: %ocamlopt -g -warn-error A -package llvm.target -package
> llvm.all_backends -linkpkg %T/target.ml -o %t
>   * RUN: %t %t.bc
>   * XFAIL: vg_leak
>   *)
> 
> Modified: llvm/trunk/test/Bindings/OCaml/vectorize.ml
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/OCaml/vectorize.ml?rev=221137&r1=221136&r2=221137&view=diff
> ==============================================================================
> --- llvm/trunk/test/Bindings/OCaml/vectorize.ml (original)
> +++ llvm/trunk/test/Bindings/OCaml/vectorize.ml Mon Nov  3 03:50:53
> 2014
> @@ -1,5 +1,7 @@
>  (* RUN: cp %s %T/vectorize_opts.ml
> - * RUN: %ocamlcomp -g -warn-error A -package llvm.vectorize -linkpkg
> %T/vectorize_opts.ml -o %t
> + * RUN: %ocamlc -g -warn-error A -package llvm.vectorize -linkpkg
> %T/vectorize_opts.ml -o %t
> + * RUN: %t %t.bc
> + * RUN: %ocamlopt -g -warn-error A -package llvm.vectorize -linkpkg
> %T/vectorize_opts.ml -o %t
>   * RUN: %t %t.bc
>   * XFAIL: vg_leak
>   *)
> 
> Modified: llvm/trunk/test/lit.cfg
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lit.cfg?rev=221137&r1=221136&r2=221137&view=diff
> ==============================================================================
> --- llvm/trunk/test/lit.cfg (original)
> +++ llvm/trunk/test/lit.cfg Mon Nov  3 03:50:53 2014
> @@ -102,13 +102,22 @@ for options in ['ASAN_OPTIONS', 'UBSAN_O
>  
>  # Set up OCAMLPATH to include newly built OCaml libraries.
>  llvm_lib_dir = getattr(config, 'llvm_lib_dir', None)
> -if llvm_lib_dir: # empty llvm_lib_dir is falsey, reads as None
> -    llvm_ocaml_lib = os.path.join(llvm_lib_dir, 'ocaml')
> -    if 'OCAMLPATH' in os.environ:
> -        ocamlpath = os.path.pathsep.join((llvm_ocaml_lib,
> os.environ['OCAMLPATH']))
> -        config.environment['OCAMLPATH'] = ocamlpath
> -    else:
> -        config.environment['OCAMLPATH'] = llvm_ocaml_lib
> +if not llvm_lib_dir:
> +    llvm_lib_dir = os.path.join(getattr(config, 'llvm_obj_root',
> None), 'lib')

Before this change, I used to be able to run llvm-lit from the command line on a specific test. Now I can't:

$ /path/to/llvm-trunk-writable-build/Release+Asserts/bin/llvm-lit -v test/Transforms/LoadCombine/load-combine.ll 
llvm-lit: TestingConfig.py:108: fatal: unable to parse config file '/path/to/llvm-trunk-writable/test/lit.cfg', traceback: Traceback (most recent call last):
  File "/path/to/llvm-trunk-writable/utils/lit/lit/TestingConfig.py", line 95, in load_from_path
    exec(compile(data, path, 'exec'), cfg_globals, None)
  File "/path/to/llvm-trunk-writable/test/lit.cfg", line 106, in <module>
    llvm_lib_dir = os.path.join(getattr(config, 'llvm_obj_root', None), 'lib')
  File "/usr/lib/python2.7/posixpath.py", line 68, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

Can you please fix this?

Thanks,
Hal

> +
> +llvm_ocaml_lib = os.path.join(llvm_lib_dir, 'ocaml')
> +if 'OCAMLPATH' in os.environ:
> +    ocamlpath = os.path.pathsep.join((llvm_ocaml_lib,
> os.environ['OCAMLPATH']))
> +    config.environment['OCAMLPATH'] = ocamlpath
> +else:
> +    config.environment['OCAMLPATH'] = llvm_ocaml_lib
> +
> +if 'CAML_LD_LIBRARY_PATH' in os.environ:
> +    caml_ld_library_path = os.path.pathsep.join((llvm_ocaml_lib,
> +                                os.environ['CAML_LD_LIBRARY_PATH']))
> +    config.environment['CAML_LD_LIBRARY_PATH'] =
> caml_ld_library_path
> +else:
> +    config.environment['CAML_LD_LIBRARY_PATH'] =
> caml_ld_library_path
>  
>  # Set up OCAMLRUNPARAM to enable backtraces in OCaml tests.
>  config.environment['OCAMLRUNPARAM'] = 'b'
> @@ -188,12 +197,13 @@ config.substitutions.append( ('%python',
>  
>  # OCaml substitutions.
>  # Support tests for both native and bytecode builds.
> -if config.have_ocamlopt == '1':
> -    config.substitutions.append( ('%ocamlcomp',
> +config.substitutions.append( ('%ocamlc',
> +    "%s ocamlc %s" % (config.ocamlfind_executable,
> config.ocaml_flags)) )
> +if config.have_ocamlopt in ('1', 'TRUE'):
> +    config.substitutions.append( ('%ocamlopt',
>          "%s ocamlopt %s" % (config.ocamlfind_executable,
>          config.ocaml_flags)) )
>  else:
> -    config.substitutions.append( ('%ocamlcomp',
> -        "%s ocamlc %s" % (config.ocamlfind_executable,
> config.ocaml_flags)) )
> +    config.substitutions.append( ('%ocamlopt', "true" ) )
>  
>  # For each occurrence of an llvm tool name as its own word, replace
>  it
>  # with the full path to the build directory holding that tool.  This
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-commits mailing list