[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #51877] [Windows] test run fails
From: |
Avinoam Kalma |
Subject: |
[Octave-bug-tracker] [bug #51877] [Windows] test run fails |
Date: |
Mon, 28 Aug 2017 00:25:04 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36 |
URL:
<http://savannah.gnu.org/bugs/?51877>
Summary: [Windows] test run fails
Project: GNU Octave
Submitted by: avinoam
Submitted on: Mon 28 Aug 2017 04:25:02 AM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: Avinoam
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Microsoft Windows
_______________________________________________________
Details:
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.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?51877>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #51877] [Windows] test run fails,
Avinoam Kalma <=