bugGNU Octave - Bugs: bug #51877, [Windows] test run fails

 
 

bug #51877: [Windows] test run fails

Submitter:  Avinoam Kalma <avinoam>
Submitted:  Mon 28 Aug 2017 04:25:02 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Avinoam Open/Closed:  * Closed
Release:  * dev Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 28 Aug 2017 06:34:21 AM UTC, comment #3: 

Thank you Avinoam for noticing, I did not see the impact for Windows, and thank you Rik for fixing it quickly!

Kai Torben Ohlhus <siko1056>
Group Member
Mon 28 Aug 2017 05:30:18 AM UTC, comment #2: 

Yes, it does, thanks.
Marking as fixed.

Avinoam Kalma <avinoam>
Group Member
Mon 28 Aug 2017 05:13:21 AM UTC, comment #1: 

This should be fixed by this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/df49ac93f50c).  Marking as Ready for Test.

Rik <rik5>
Group administrator
Mon 28 Aug 2017 04:25:02 AM UTC, original submission:  


One of two BIST added to run.m in http://hg.savannah.gnu.org/hgweb/octave/rev/0d5fc6e4a96c fails in Windows:


>> test run
warning: addpath: C:UsersvinoamAppDataLocalTempoct-IaJQvv: No such file or directory
warning: rmpath: C:\Users\avinoam\AppData\Local\Temp\oct-IaJQvv: not found
***** test
 tmp_dir = tempname ();
 mkdir (tmp_dir);
 test_function = fullfile (tmp_dir, "tf.m");
 fid = fopen (test_function, "w");
 fprintf (fid, "function tf ()\n");
 fprintf (fid, "  addpath (\"%s\");\n", tmp_dir);
 fprintf (fid, "endfunction\n");
 fclose (fid);
 ## Check if temporary directory is on the loadpath.
 ## Function 'dir_in_loadpath' is broken for this use case, so code a test.
 dirs = strsplit (path (), ":");
 tstval1 = any (strcmp (tmp_dir, dirs));
 run (test_function);
 dirs = strsplit (path (), ":");
 tstval2 = any (strcmp (tmp_dir, dirs));
 unlink (test_function);
 rmdir (tmp_dir);
 rmpath (tmp_dir);
 assert (tstval1, false);
 assert (tstval2, true);
!!!!! test failed
ASSERT errors for:  assert (tstval2,true)

  Location  |  Observed  |  Expected  |  Reason
     ()           0            1         Abs err 1 exceeds tol 0


There are two problems here:

The line


 fprintf (fid, "  addpath (\"%s\");\n", tmp_dir);


tries to add to the path the directory, but without the backslashes, and that cause the error


warning: addpath: C:UsersvinoamAppDataLocalTempoct-IaJQvv: No such file or directory


The solution is is simple - change the double quote to single quote:


 fprintf (fid, "  addpath (\'%s\');\n", tmp_dir);


The second problem is that the Windows path is not ":" separated, and moreover, ":" is part of the directory name, so the strsplit does not work well.

Avinoam Kalma <avinoam>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by avinoam (Submitted the item)
  • -email is unavailable- added by avinoam
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-08-28 siko1056 Open/ClosedOpen Closed
    2017-08-28 avinoam StatusReady For Test Fixed
    2017-08-28 rik5 StatusNone Ready For Test
    2017-08-28 avinoam Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code