<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix"><br>
      True, if you want the same config file as input to both, you need
      the "userconfig" feature in Common Test:<br>
      <br>
<a class="moz-txt-link-freetext" href="http://www.erlang.org/doc/apps/common_test/config_file_chapter.html#id79185">http://www.erlang.org/doc/apps/common_test/config_file_chapter.html#id79185</a><br>
      <a class="moz-txt-link-freetext" href="http://www.erlang.org/doc/man/ct_run.html">http://www.erlang.org/doc/man/ct_run.html</a><br>
      <a class="moz-txt-link-freetext" href="http://www.erlang.org/doc/man/ct.html#run_test-1">http://www.erlang.org/doc/man/ct.html#run_test-1</a><br>
      <br>
        /Peter<br>
      <br>
      <br>
      On 2015-04-23 15:56, Roberto Ostinelli wrote:<br>
    </div>
    <blockquote
cite="mid:CAM5fRyqyhuFFPZaQesuh69U84Wso0j8PzvSgqCH4=aw13YNR5w@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <div dir="ltr">Unfortunately that doesn't work.
        <div><br>
        </div>
        <div>`test.config` for application needs to be a file which
          encloses a list of Applications, i.e. [{App1, [App1Config]},
          {App2, [App2Config]}].</div>
        <div>`test.config` for CT needs to be a file which has
          individual entries *not* enclosed in a list, i.e. {App1,
          [App1Config]}. {App2, [App2Config]}.</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Thu, Apr 23, 2015 at 3:50 PM, Peter
          Andersson <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:peppe@erlang.org" target="_blank">peppe@erlang.org</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div><br>
                Well, if you want the same config file as input to both
                your application and to CT:<br>
                <br>
                ct_run -config test.config -erl_args -config test.config<span
                  class="HOEnZb"><font color="#888888"><br>
                    <br>
                      /Peter</font></span>
                <div>
                  <div class="h5"><br>
                    <br>
                    On 2015-04-23 15:24, Roberto Ostinelli wrote:<br>
                  </div>
                </div>
              </div>
              <div>
                <div class="h5">
                  <blockquote type="cite">
                    <div dir="ltr">Thank you Loïc, this works (i.e.
                      `myapp` now starts) but now I'm unable to read
                      this config file in <span
                        style="font-size:12.8000001907349px">`myapp_SUITE.erl`.</span>
                      <div><span style="font-size:12.8000001907349px"><br>
                        </span></div>
                      <div><span style="font-size:12.8000001907349px">`application:get_env(myapp,

                          mykey)` and </span><span
                          style="font-size:12.8000001907349px">`ct:get_config({myapp,

                          mykey})` both </span><span
                          style="font-size:12.8000001907349px">return
                          `undefined`.</span></div>
                    </div>
                    <div class="gmail_extra"><br>
                      <div class="gmail_quote">On Thu, Apr 23, 2015 at
                        1:53 PM, Loïc Hoguin <span dir="ltr"><<a
                            moz-do-not-send="true"
                            href="mailto:essen@ninenines.eu"
                            target="_blank">essen@ninenines.eu</a>></span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0
                          0 0 .8ex;border-left:1px #ccc
                          solid;padding-left:1ex">ct_run -erl_args
                          -config test.config
                          <div>
                            <div><br>
                              <br>
                              On 04/23/2015 02:41 PM, Roberto Ostinelli
                              wrote:<br>
                            </div>
                          </div>
                          <blockquote class="gmail_quote"
                            style="margin:0 0 0 .8ex;border-left:1px
                            #ccc solid;padding-left:1ex">
                            <div>
                              <div> All,<br>
                                I've got an app `myapp` which uses a
                                standard `sys.config` file.<br>
                                I'd like to test it using Common Tests,
                                with a test configuration file.<br>
                                <br>
                                I'm passing the variable `-config
                                test.config` to ct_run.<br>
                                <br>
                                However, when I start my app from the
                                Common Test suite<br>
                                `myapp_SUITE.erl` then the app fails to
                                start because inside the app<br>
                                `application:get_env(myapp, mykey)`
                                returns `undefined`. I can, however,<br>
                                read this variable with
                                `ct:get_config({myapp, mykey})`.<br>
                                <br>
                                How am I supposed to use a custom
                                `test.config` file that is loaded in<br>
                                ct_run *and* read by the app itself?<br>
                                <br>
                                I've spent almost a day on this and I'm
                                honestly 5 minutes away from<br>
                                dropping all this in the dustbin and
                                using an external test tool<br>
                                instead. Please help me stick to Erlang.
                                :)<br>
                                <br>
                                r.<br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                              </div>
                            </div>
_______________________________________________<br>
                            erlang-questions mailing list<br>
                            <a moz-do-not-send="true"
                              href="mailto:erlang-questions@erlang.org"
                              target="_blank">erlang-questions@erlang.org</a><br>
                            <a moz-do-not-send="true"
                              href="http://erlang.org/mailman/listinfo/erlang-questions"
                              target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
                            <br>
                            <span><font color="#888888"> </font></span></blockquote>
                          <span><font color="#888888"> <br>
                              -- <br>
                              Loïc Hoguin<br>
                              <a moz-do-not-send="true"
                                href="http://ninenines.eu"
                                target="_blank">http://ninenines.eu</a><br>
                            </font></span></blockquote>
                      </div>
                      <br>
                    </div>
                    <br>
                    <fieldset></fieldset>
                    <br>
                    <pre>_______________________________________________
erlang-questions mailing list
<a moz-do-not-send="true" href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a>
<a moz-do-not-send="true" href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
            <br>
            _______________________________________________<br>
            erlang-questions mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
            <a moz-do-not-send="true"
              href="http://erlang.org/mailman/listinfo/erlang-questions"
              target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>