aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/filelib_SUITE.erl
AgeCommit message (Collapse)Author
2018-01-15Merge branch 'maint'Hans Bolinder
* maint: stdlib: Correct a filelib test case stdlib: Let filelib:find_source() search subdirs
2018-01-05stdlib: Correct a filelib test caseHans Bolinder
2018-01-05stdlib: Let filelib:find_source() search subdirsHans Bolinder
The Design Principles states that an application can have Erlang source files one level below the "src" directory, and now filelib:find_source() by default searches one level below "src". The same applies to "esrc". That directory is only mentioned in filename(3).
2017-11-30Account for new behavior in tests that touch prim_fileJohn Högberg
This also hides the module behind ?PRIM_FILE to make testing new implementations less painful.
2017-10-04Implement escaping of special characters in wildcardsBjörn Gustavsson
Allow characters with special meaning to be escaped using \ (which must be writen as \\ in a string). That allows matching of filenames containing characters that are special in wildcards. This is an incompatible change, but note that the use of backslashes in wildcards would already work differently on Windows and Unix. Take for example this call: filelib:wildcard("a\\b") On Windows, filelib:wildcard/1 would look for a directory named "a", and a file or directory named "b" inside it. On Unix, filelib:wildcard/1 would look for a file named "a\\b". With this commit applied, filelib:wildcard/1 will look for a file named "ab" on both Windows and Unix. https://bugs.erlang.org/browse/ERL-451
2017-05-04Update copyright yearRaimo Niskanen
2017-04-07Teach filelib_SUITE to work when STDLIB is cover-compiledBjörn Gustavsson
filelib_SUITE:find_source/1 would fail when running the tests with STDLIB cover-compiled.
2017-02-04Add filelib:find_file/2/3 and filelib:find_source/1/2/3Richard Carlsson
This moves, extends and exports functionality that previously existed only internally in filename:find_src/1/2, adding the ability to automatically substitute file suffixes and use different rules for different suffixes.
2016-03-15update copyright-yearHenrik Nord
2016-03-09Eliminate use of ?config() macroBjörn Gustavsson
2016-03-09Remove ?line macrosBjörn Gustavsson
While we are it, also re-ident the files.
2016-03-09Eliminate 'suite' and 'doc' clausesBjörn Gustavsson
2016-03-09Modernize use of timetrapsBjörn Gustavsson
Either rely on the default 30 minutes timetrap, or set the timeout using the supported methods in common_test.
2016-02-17Eliminate use of test_server.hrl and test_server_line.hrlBjörn Gustavsson
As a first step to removing the test_server application as as its own separate application, change the inclusion of test_server.hrl to an inclusion of ct.hrl and remove the inclusion of test_server_line.hrl.
2015-12-11stdlib tests: Replace 'random' with 'rand'Björn Gustavsson
2015-06-18Change license text to APLv2Bruce Yinhe
2014-10-02Merge branch 'siri/filename-join-2/OTP-12158'Siri Hansen
* siri/filename-join-2/OTP-12158: Fix handling of single dot in filename:join/2
2014-10-01Merge branch 'capflam/filelib_wildcard_fix' into maintMarcus Arendt
* capflam/filelib_wildcard_fix: Fix filelib:wildcard/2 when 'Cwd' ends with a dot
2014-09-25Fix handling of single dot in filename:join/2Siri Hansen
The reference manual says that filename:join(A,B) is equivalent to filename:join([A,B]). In some rare cases this turns out not to be true: 1> filename:join("/a/.","b"). "/a/./b" 2> filename:join(["/a/.","b"]). "/a/b" In general, filename:join/1,2 removes single dots from the resulting path, except dots that occur at the beginning or end of the path. The problem above occurs when the first argument to join/2 ends with a dot, then it is not removed even if the second argument differs from an empty string and thus the dot ends up in "the middle" of the path. This commit corrects this problem. A single dot is now only kept if it occurs at the very beginning or the very end of the resulting path. Test of filename:join/1,2 are added in filename_SUITE. In addition, filelib_SUITE is updated with more tests of filelib:wildcard/2 since this failed when the given current directory (second argument) ended with a dot.
2014-07-14Fix filelib:wildcard/2 when 'Cwd' ends with a dotChristopher Faulet
In such case, filelib:wildcard/2 returned truncated results: 1> file:set_cwd("/usr/lib/erlang/lib"). ok 2> filelib:wildcard("stdlib-*/ebin/*.app", filename:absname(".")). ["dlib-2.1/ebin/stdlib.app"]
2014-07-09Add tests of filelib and symlinksSiri Hansen
This commit complements 769996c0cd4cb68c157e39de725642f209ed7423 and adds tests for the following problems introduced by f11aabdc9fec593c31e6c4f3fa25c1707e9c35df: Given the symlink 'dirlink' pointing to an existing dir, then - filelib:is_regular("dirlink") -> false - filelib:is_dir("dirlink") -> false Given the symlink 'filelink' pointing to an existing file, then - filelib:is_regular("filelink") -> false - filelib:is_file("filelink") -> false - filelib:last_modified("filelink") and filelib:filesize("filelink") return the info of the link and not the file Given the symlink "broken_symlink" pointing to a non-existing file, then - filelib:wildcard("broken_symlink",File) -> []
2014-07-09Fix handling of broken symlinks in filelibAnthony Ramine
This fixes a bug introduced in f11aabdc9fec593c31e6c4f3fa25c1707e9c35df where filelib:eval_read_file_info/2 was made to use file:read_link_info/1 to never follow symlinks. This fixed wildcard/1 but broke every other function using eval_read_file_info/2. Reported-by: Louis-Philippe Gauthier Reported-by: Danil Zagoskin
2014-04-10filelib:wildcard() should show broken symlinksBjörn Gustavsson
filelib:wildcard("broken_symlink") would return an empty list if "broken_symlink" is a symlink that does not point to an existing file.
2013-02-13Don't allow binaries as the Cwd argument for filelib:wildcard()Björn Gustavsson
filelib:wildcard() will no longer support "raw filenames", so it makes no sense for it to accept a binary Cwd argument.
2013-02-13Strengthen test suiteBjörn Gustavsson
2013-01-25Update copyright yearsBjörn-Egil Dahlberg
2012-09-17Allow ** in filelib:wildcardJosé Valim
Two adjacent * used as a single pattern will match all files and zero or more directories and subdirectories.
2012-09-12Fix filelib:wildcard/2Björn Gustavsson
filelib:wildcard("some/relative/path/*.beam", Path) would fail to match any file. That is, filelib:wildcard/2 would not work if the first component of the pattern did not contain any wildcard characters. Noticed-by: Samuel Rivas
2011-09-02Merge branch 'dev' into majorHans Bolinder
* dev: Fix a couple of minor bugs with hook priority Update to reflect addition of CTH priority addition Update CTH priority default to be 0 Update to reflect new cth callback api Update the return from init/2 to be {ok, NewState} or {ok,NewState,Priority} instead of NewState. Add priority functionality and tests for ct hooks Update internal hooks state to use a record instead of tuples Improve and correct types and specifications in Kernel and STDLIB
2011-08-31Improve and correct types and specifications in Kernel and STDLIBHans Bolinder
Running Dialyzer on the test suites revealed a few type errors.
2011-08-16emulator: Add a fourth element in exception stacktracesBjörn Gustavsson
This commit is a preparation for introducing location information (filename/line number) in stacktraces in exceptions. Currently a stack trace looks like: [{Mod1,Function1,Arity1}, . . . {ModN,FunctionN,ArityN}] Add a forth element to each tuple that can be used indication the filename and line number of the source file: [{Mod1,Function1,Arity1,Location1}, . . . {ModN,FunctionN,ArityN,LocationN}] In this commit, the fourth element will just be an empty list, and we will change all code that look at or manipulate stacktraces.
2011-03-11Update copyright yearsBjörn-Egil Dahlberg
2011-02-17Rename Suite Callback to Common Test HookLukas Larsson
2011-02-17Fix formatting for stdlibLukas Larsson
2011-02-17Add init_per_suite and end_per_suiteLukas Larsson
2011-02-17Add ts_install_scb to suite/0Lukas Larsson
2011-02-17Update stdlib tests to conform with common_test standardLukas Larsson
2011-02-17Update all fin_per_testcase to end_per_testcase.Lukas Larsson
2010-12-03Test and correct filelib and filenamePatrik Nyblom
2010-01-30Merge branch 'ta/ensure_dir_eexist' into ccase/r13b04_devErlang/OTP
* ta/ensure_dir_eexist: filelib_SUITE: strenghten tests of filelib:ensure_dir/1 Don't return a false {error,eexist} in filelib:ensure_dir/1 OTP-8389 Because of a race condition, using filelib:ensure_dir/1 from multiple processes to create the same path or parts of the same directory structure, filelib:ensure_dir/1 could return a meaningless {error,eexist}. That race condition has been eliminated, and {error,eexist} will now be returned only if there exists a regular file, device file, or some other non-directory file with the same name. (Thanks to Tuncer Ayaz.)
2010-01-23filelib_SUITE: strenghten tests of filelib:ensure_dir/1Björn Gustavsson
Test that filelib:ensure_dir/1 returns {error,eexist} if there already exists a regular file with the name as a directory that should be created. While at it, slightly strenghten the otp_5960/1 test case by repeating each call to filelib:ensure_dir/1.
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP