11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../common');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ciconst path = require('path');
61cb0ef41Sopenharmony_ciconst fs = require('fs');
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ciconst tmpdir = require('../common/tmpdir');
91cb0ef41Sopenharmony_citmpdir.refresh();
101cb0ef41Sopenharmony_ciconst tmpDir = tmpdir.path;
111cb0ef41Sopenharmony_ciconst longPath = path.join(...[tmpDir].concat(Array(30).fill('1234567890')));
121cb0ef41Sopenharmony_cifs.mkdirSync(longPath, { recursive: true });
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci// Test if we can have symlinks to files and folders with long filenames
151cb0ef41Sopenharmony_ciconst targetDirectory = path.join(longPath, 'target-directory');
161cb0ef41Sopenharmony_cifs.mkdirSync(targetDirectory);
171cb0ef41Sopenharmony_ciconst pathDirectory = path.join(tmpDir, 'new-directory');
181cb0ef41Sopenharmony_cifs.symlink(targetDirectory, pathDirectory, 'dir', common.mustSucceed(() => {
191cb0ef41Sopenharmony_ci  assert(fs.existsSync(pathDirectory));
201cb0ef41Sopenharmony_ci}));
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ciconst targetFile = path.join(longPath, 'target-file');
231cb0ef41Sopenharmony_cifs.writeFileSync(targetFile, 'data');
241cb0ef41Sopenharmony_ciconst pathFile = path.join(tmpDir, 'new-file');
251cb0ef41Sopenharmony_cifs.symlink(targetFile, pathFile, common.mustSucceed(() => {
261cb0ef41Sopenharmony_ci  assert(fs.existsSync(pathFile));
271cb0ef41Sopenharmony_ci}));
28