Skip to content

Commit 1fad765

Browse files
committed
add test for /usr/local
1 parent 2a1c9c7 commit 1fad765

File tree

3 files changed

+202
-0
lines changed

3 files changed

+202
-0
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
comment_char %
2+
escape_char /
3+
4+
% This file is part of the GNU C Library and contains locale data.
5+
% The Free Software Foundation does not claim any copyright interest
6+
% in the locale data contained in this file. The foregoing does not
7+
% affect the license of the GNU C Library as a whole. It does not
8+
% exempt you from the conditions of the license if your use would
9+
% otherwise be governed by that license.
10+
11+
LC_IDENTIFICATION
12+
title "English locale for the USA with ISO formats"
13+
language "American English"
14+
15+
category "i18n:2012";LC_IDENTIFICATION
16+
category "i18n:2012";LC_CTYPE
17+
category "i18n:2012";LC_COLLATE
18+
category "i18n:2012";LC_TIME
19+
category "i18n:2012";LC_NUMERIC
20+
category "i18n:2012";LC_MONETARY
21+
category "i18n:2012";LC_MESSAGES
22+
category "i18n:2012";LC_PAPER
23+
category "i18n:2012";LC_NAME
24+
category "i18n:2012";LC_ADDRESS
25+
category "i18n:2012";LC_TELEPHONE
26+
category "i18n:2012";LC_MEASUREMENT
27+
END LC_IDENTIFICATION
28+
29+
LC_TIME
30+
day "Sunday";/
31+
"Monday";/
32+
"Tuesday";/
33+
"Wednesday";/
34+
"Thursday";/
35+
"Friday";/
36+
"Saturday"
37+
abday "Sun";/
38+
"Mon";/
39+
"Tue";/
40+
"Wed";/
41+
"Thu";/
42+
"Fri";/
43+
"Sat"
44+
45+
mon "January";/
46+
"February";/
47+
"March";/
48+
"April";/
49+
"May";/
50+
"June";/
51+
"July";/
52+
"August";/
53+
"September";/
54+
"October";/
55+
"November";/
56+
"December"
57+
abmon "Jan";/
58+
"Feb";/
59+
"Mar";/
60+
"Apr";/
61+
"May";/
62+
"Jun";/
63+
"Jul";/
64+
"Aug";/
65+
"Sep";/
66+
"Oct";/
67+
"Nov";/
68+
"Dec"
69+
70+
date_fmt "%a %d %b %Y %T %Z"
71+
d_t_fmt "%a %d %b %Y %T"
72+
d_fmt "%Y-%m-%d"
73+
t_fmt "%T"
74+
t_fmt_ampm ""
75+
am_pm "";""
76+
week 7;19971130;4
77+
first_weekday 2
78+
END LC_TIME
79+
80+
LC_CTYPE
81+
copy "en_US"
82+
END LC_CTYPE
83+
84+
LC_COLLATE
85+
copy "en_US"
86+
END LC_COLLATE
87+
88+
LC_MONETARY
89+
copy "en_US"
90+
END LC_MONETARY
91+
92+
LC_NUMERIC
93+
decimal_point "."
94+
thousands_sep ","
95+
grouping 3;3
96+
END LC_NUMERIC
97+
98+
LC_MESSAGES
99+
copy "en_US"
100+
END LC_MESSAGES
101+
102+
LC_PAPER
103+
copy "i18n"
104+
END LC_PAPER
105+
106+
LC_TELEPHONE
107+
copy "en_US"
108+
END LC_TELEPHONE
109+
110+
LC_MEASUREMENT
111+
copy "i18n"
112+
END LC_MEASUREMENT
113+
114+
LC_NAME
115+
copy "en_US"
116+
END LC_NAME
117+
118+
LC_ADDRESS
119+
copy "en_US"
120+
END LC_ADDRESS
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
# Copyright (c) Ansible Project
3+
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
4+
# SPDX-License-Identifier: GPL-3.0-or-later
5+
6+
- name: Is the locale we're going to test against installed?
7+
command: locale -a
8+
register: initial_state
9+
10+
- name: Make sure the locale is not installed (BEGIN)
11+
community.general.locale_gen:
12+
name: en_US@iso
13+
state: absent
14+
ignore_errors: true
15+
register: not_available
16+
17+
- name: Ensure /usr/local/share/i18n/
18+
ansible.builtin.file:
19+
path: /usr/local/share/i18n/locales
20+
state: directory
21+
mode: '0755'
22+
23+
- name: Back up /etc/locale.gen
24+
ansible.builtin.copy:
25+
src: /etc/locale.gen
26+
dest: /etc/locale.gen.bkp
27+
28+
- name: Add line to /etc/locale.gen
29+
ansible.builtin.shell: >
30+
echo "# en_US@iso UTF-8" >> /etc/locale.gen
31+
32+
- name: Copy custom locale
33+
ansible.builtin.copy:
34+
dest: /usr/local/share/i18n/locales/en_US@iso
35+
src: en_US@iso
36+
mode: '0644'
37+
38+
- name: Add custom locale to SUPPORTED
39+
ansible.builtin.copy:
40+
dest: /usr/local/share/i18n/SUPPORTED
41+
content: |
42+
en_US@iso UTF-8
43+
mode: '0644'
44+
45+
- name: Make sure the locale is available
46+
community.general.locale_gen:
47+
name: en_US@iso
48+
state: absent
49+
register: available
50+
51+
- name: Make sure the locale is installed
52+
community.general.locale_gen:
53+
name: en_US@iso
54+
state: present
55+
register: installed
56+
57+
- name: Check assertions
58+
ansible.builtin.assert:
59+
that:
60+
- not_available is failed
61+
- >
62+
"locales you have entered are not available on your system: en_US@iso" in not_available.msg
63+
- available is not changed
64+
- installed is changed
65+
66+
- name: Make sure the locale is not installed (END)
67+
community.general.locale_gen:
68+
name: en_US@iso
69+
state: absent
70+
71+
- name: Remove /usr/local/share/i18n/
72+
ansible.builtin.file:
73+
path: /usr/local/share/i18n/
74+
state: absent
75+
76+
- name: Restore /etc/locale.gen
77+
ansible.builtin.copy:
78+
src: /etc/locale.gen.bkp
79+
dest: /etc/locale.gen

tests/integration/targets/locale_gen/tasks/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@
1717
loop: "{{ locale_list_basic }}"
1818
loop_control:
1919
loop_var: locale_basic
20+
21+
- name: Run tests for 11046
22+
ansible.builtin.include_tasks: 11046-usrlocal.yml

0 commit comments

Comments
 (0)