Test generation of cms/cmsi files using (bin_annot_cms ...) in env stanza and via flags.
On OxCaml compilers (where Ocaml_config.ox is true), bin_annot_cms defaults to true.

This test compares four configurations:
1. default: same as (env (_ (bin_annot_cms true)))
2. env stanza: (env (_ (bin_annot_cms true))) - explicit enable
3. flags field: (flags (:standard -bin-annot-cms)) - passes flag directly to compiler
4. env stanza: (env (_ (bin_annot_cms false))) - explicit disable

Key differences between env stanza and flags field:
- env stanza settings apply to ALL modules including auto-generated alias modules
- flags field only applies to user modules, NOT to auto-generated alias modules, 
| because Compilation_context.for_alias_module resets flags to defaults.
- env stanza only generates cms/cmsi during byte/cmi compilation (like cmt/cmti), 
| whereas flags field passes the flag to ALL compilations including native

Create a project with OxCaml language extension (required for bin_annot_cms):

  $ cat >dune-project <<EOF
  > (lang dune 3.21)
  > (using oxcaml 0.1)
  > EOF

Create four libraries to test different configurations:

  $ mkdir -p oxcaml_default with_env_stanza with_flags_field without_flag

Default setting, same as (bin_annot_cms true):

  $ cat >oxcaml_default/foo.ml <<EOF
  > type t = bool
  > let f x = if x then false else true
  > EOF

  $ cat >oxcaml_default/foo.mli <<EOF
  > type t
  > val f : t -> t
  > EOF

  $ cat >oxcaml_default/dune <<EOF
  > (library (name oxcaml_default))
  > EOF


Library using env stanza (bin_annot_cms true):

  $ cat >with_env_stanza/foo.ml <<EOF
  > type t = int
  > let f x = x + 1
  > EOF

  $ cat >with_env_stanza/foo.mli <<EOF
  > type t
  > val f : t -> t
  > EOF

  $ cat >with_env_stanza/dune <<EOF
  > (env (_ (bin_annot_cms true) (bin_annot true)))
  > (library (name with_env_stanza))
  > EOF

Library using flags field (-bin-annot-cms):

  $ cat >with_flags_field/bar.ml <<EOF
  > type t = string
  > let g x = x ^ "!"
  > EOF

  $ cat >with_flags_field/bar.mli <<EOF
  > type t
  > val g : t -> t
  > EOF

  $ cat >with_flags_field/dune <<EOF
  > (library
  >  (name with_flags_field)
  >  (flags (:standard -bin-annot-cms -bin-annot)))
  > EOF

Library with bin_annot_cms explicitly disabled (should NOT produce cms files):

  $ cat >without_flag/baz.ml <<EOF
  > type t = float
  > let h x = x +. 1.0
  > EOF

  $ cat >without_flag/baz.mli <<EOF
  > type t
  > val h : t -> t
  > EOF

  $ cat >without_flag/dune <<EOF
  > (env (_ (bin_annot_cms false)))
  > (library (name without_flag))
  > EOF

  $ dune build

Verify cms/cmsi files are generated for both env stanza and flags approaches.

default: .cms/.cmsi files are generated by default in the byte folder.
  $ find _build/default/oxcaml_default -name '*.cms' -o -name '*.cmsi' -o -name "*.cmt" -o -name "*.cmti" | sort
  _build/default/oxcaml_default/.oxcaml_default.objs/byte/oxcaml_default.cms
  _build/default/oxcaml_default/.oxcaml_default.objs/byte/oxcaml_default.cmt
  _build/default/oxcaml_default/.oxcaml_default.objs/byte/oxcaml_default__Foo.cms
  _build/default/oxcaml_default/.oxcaml_default.objs/byte/oxcaml_default__Foo.cmsi
  _build/default/oxcaml_default/.oxcaml_default.objs/byte/oxcaml_default__Foo.cmt
  _build/default/oxcaml_default/.oxcaml_default.objs/byte/oxcaml_default__Foo.cmti


with_env_stanza: Note that both the alias module (with_env_stanza.cms) and user
module (with_env_stanza__Foo.cms) have cms files. All files are in byte/ only
(like cmt/cmti).

  $ find _build/default/with_env_stanza -name '*.cms' -o -name '*.cmsi' -o -name "*.cmt" -o -name "*.cmti" | sort
  _build/default/with_env_stanza/.with_env_stanza.objs/byte/with_env_stanza.cms
  _build/default/with_env_stanza/.with_env_stanza.objs/byte/with_env_stanza.cmt
  _build/default/with_env_stanza/.with_env_stanza.objs/byte/with_env_stanza__Foo.cms
  _build/default/with_env_stanza/.with_env_stanza.objs/byte/with_env_stanza__Foo.cmsi
  _build/default/with_env_stanza/.with_env_stanza.objs/byte/with_env_stanza__Foo.cmt
  _build/default/with_env_stanza/.with_env_stanza.objs/byte/with_env_stanza__Foo.cmti

with_flags_field: Note that cms/cmt files appear in native/ because the flags
are passed to all compilations. But the module alias file does not get an entry
in the native directory, because its flags are reset to default (dropping the
user flags).

  $ find _build/default/with_flags_field -name '*.cms' -o -name '*.cmsi' -o -name "*.cmt" -o -name "*.cmti" | sort
  _build/default/with_flags_field/.with_flags_field.objs/byte/with_flags_field.cms
  _build/default/with_flags_field/.with_flags_field.objs/byte/with_flags_field.cmt
  _build/default/with_flags_field/.with_flags_field.objs/byte/with_flags_field__Bar.cms
  _build/default/with_flags_field/.with_flags_field.objs/byte/with_flags_field__Bar.cmsi
  _build/default/with_flags_field/.with_flags_field.objs/byte/with_flags_field__Bar.cmt
  _build/default/with_flags_field/.with_flags_field.objs/byte/with_flags_field__Bar.cmti
  _build/default/with_flags_field/.with_flags_field.objs/native/with_flags_field__Bar.cms
  _build/default/with_flags_field/.with_flags_field.objs/native/with_flags_field__Bar.cmt

without_flag: No cms/cmsi files since bin_annot_cms is explicitly disabled. Only cmt/cmti
from the default bin_annot=true setting.

  $ find _build/default/without_flag -name '*.cms' -o -name '*.cmsi' -o -name "*.cmt" -o -name "*.cmti" | sort
  _build/default/without_flag/.without_flag.objs/byte/without_flag.cmt
  _build/default/without_flag/.without_flag.objs/byte/without_flag__Baz.cmt
  _build/default/without_flag/.without_flag.objs/byte/without_flag__Baz.cmti
